News for hackers. Stuff that matters.
Re:Why Most Unit Testing is Waste (2014) [pdf] by jghn on Monday May 30, 2016 @12:19AM (#11799531)
Tests are not proofs, types provide proofs. Tests demonstrate that the exact conditions being tested actually work. That's not a bad thing but when working with static typing and robust type systems the need for unit testing goes down tremendously compared to dynamic languages.
Re:Why Most Unit Testing is Waste (2014) [pdf] by bluejekyll on Monday May 30, 2016 @01:05AM (#11799658)
While I agree with you to an extent, I'm a huge Rust fan, longtime C/C++ and Java engineer, I disagree that a strongly typed language allows you to not write unit tests.

Unit tests verify logic, the compilers only guarantee syntax. Which yes, handles a huge set of issues that in a dynamic language would require 100% test coverage, you still need to check the logic of the code. Thus, unit tests are still a huge benefit.

One reason I love Rust is the build in #[test] feature. Builtin tests from the ground up, awesome.

Re:Why Most Unit Testing is Waste (2014) [pdf] by jghn on Monday May 30, 2016 @01:13AM (#11799677)
I didn't say not write tests but that it reduces the volume of tests needed for largely the reasons you stated
Re:Why Most Unit Testing is Waste (2014) [pdf] by rubber_duck on Monday May 30, 2016 @03:38AM (#11800101)
Types provide semantic information as well so checking verifies semantics as well (extent depends on the strength of the type system).

Saying you're a Rust fan and then saying compilers only guarantee syntax when the entire point of that language is to have a constrained subset in which types guarantee no data races/leaks at compile time doesn't make sense to me.

Re:Why Most Unit Testing is Waste (2014) [pdf] by bluejekyll on Monday May 30, 2016 @05:04AM (#11800364)
I didn't mean to imply that rust doesn't provide more than just syntax. You are correct that rust provides a huge number of guarantees around semantics, but honestly, I think it's not a traditional compiler, it provides a ton of features that you don't find in C compilers for example.

Rust is the greatest thing since sliced bread, my comment was only about statically typed and compiled languages in general. I think you read more into my comment than I intended.

Re:Why Most Unit Testing is Waste (2014) [pdf] by majewsky on Monday May 30, 2016 @10:40AM (#11801537)
Of course it's a compiler. A compiler verifies that its input conforms to the syntax and semantics of its own language, and generates machine code (or some other language) equivalent to the input.

The only difference is that Rust's semantics is waaayyy more strict than C's.

Re:Why Most Unit Testing is Waste (2014) [pdf] by tracker1 on Monday May 30, 2016 @01:10AM (#11799671)
I'd counter that with dynamic language, easy modularization and the ability to create single function modules that are composable, and written as such, that code is more easily understood and doesn't require the same type of testing as more complex systems in static language, that lend to layers of indirection and complexity for the sake of testability.

I'm not saying that testing isn't needed in either place, but a lot of the times "enterprise" practices that leak into scripted environments make code far more complicated and difficult to understand than it needs to be.

Re:Why Most Unit Testing is Waste (2014) [pdf] by majewsky on Monday May 30, 2016 @10:42AM (#11801546)
Why do you assume that modules in a statically-typed language are necessarily more complex? (Except for the type annotations, of course.)

Not every statically-typed language is Java. ;)

Re:Why Most Unit Testing is Waste (2014) [pdf] by tracker1 on Tuesday May 31, 2016 @01:43PM (#11808375)
True, it does depend on the language... C#, for example is limited to Namespaces and Classes, you can't write a simple function without a lot of wrapper... partial & static classes help, but it's not the same.

Though, I will say writing tests against and with a dynamic language tends to be far easier when things are written with modularity in mind.