News for hackers. Stuff that matters.
Re:The Evolution of a Haskell Programmer (2001) by jb1991 on Monday February 08, 2016 @04:08PM (#11060905)
As Rich Hickey says often, there are two truths that are true about all bugs:

1) They passed unit tests. 2) They passed a type checker.

Re:The Evolution of a Haskell Programmer (2001) by lmm on Monday February 08, 2016 @04:20PM (#11060977)
Well no, a lot of bugs didn't pass a type checker because a lot of languages don't have them. And some projects don't have unit tests.
Re:The Evolution of a Haskell Programmer (2001) by GFK_of_xmaspast on Monday February 08, 2016 @04:42PM (#11061089)
> And some projects don't have unit tests.

If a bug did not cause a unit test to fail, then it passed the unit test suite. (Less cryptically, an empty set is still a set)

Re:The Evolution of a Haskell Programmer (2001) by recursive on Monday February 08, 2016 @05:35PM (#11061395)
If we're getting that pedantic, the quote was "they passed unit tests". If the bug passed a 0-size set of unit tests, then it didn't actually pass any unit tests.
Re:The Evolution of a Haskell Programmer (2001) by eru on Monday February 08, 2016 @06:06PM (#11061632)
They didn't pass any, but they passed all.

In any case, Rich Hickey probably had more context for his words.

Re:The Evolution of a Haskell Programmer (2001) by ank_the_elder on Monday February 08, 2016 @07:14PM (#11062000)
We should take this discussion and publish it in the world-famous (and extremely popular) "Journal of the empty set." You will find most of my work published there, too. http://pic.blog.plover.com/math/major-screwups-4/emptyset.pn...
Re:The Evolution of a Haskell Programmer (2001) by zachrose on Monday February 08, 2016 @11:52PM (#11063163)
Still though, 0% test coverage.
Re:The Evolution of a Haskell Programmer (2001) by eru on Tuesday February 09, 2016 @12:28AM (#11063312)
Division by zero..
Re:The Evolution of a Haskell Programmer (2001) by lmm on Tuesday February 09, 2016 @08:33AM (#11065110)
How so?

10 (say) lines of code, 0 lines covered by tests, test coverage is 0/10. No division by zero, nothing undefined happening.

Re:The Evolution of a Haskell Programmer (2001) by tel on Monday February 08, 2016 @07:15PM (#11062006)
Meh, that's an odd statement since it unifies the classes of bugs which pass varying qualities of (1) and (2). Certainly, "what's true of all bugs (seen in production) is that they passed the unit tests and type checkers levied against them" is nearly tautological, but leaving out those classifiers makes it into a much less meaningful statement.
Re:The Evolution of a Haskell Programmer (2001) by emergentcypher on Monday February 08, 2016 @11:29PM (#11063065)
Which tells us something about the nature of the bugs we will find in our programs.

The type-checker prevents certain classes of bugs, inconsistencies in types, lots of silly typos and mistakes. But it doesn't fix errors in our logic or algorithms. The type-checker doesn't know you should have added instead of multiplied, nor does it fix conversion errors at the borders of our programs where we, say, write a Haskell data structure into a JSON file.

Re:The Evolution of a Haskell Programmer (2001) by dllthomas on Tuesday February 09, 2016 @12:37AM (#11063347)
"The type-checker doesn't know you should have added instead of multiplied"

Dimensional analysis is a type system that knows exactly that.

Re:The Evolution of a Haskell Programmer (2001) by sordina on Monday February 08, 2016 @07:04PM (#11061955)
Well yeah, of course, but what conclusion are are you drawing from this?
Re:The Evolution of a Haskell Programmer (2001) by bribri on Tuesday February 09, 2016 @01:01PM (#11067253)
Good thing type checkers stop many bugs from happening in the first place. I do agree with him that conceptually simple dynamic (Clojure) > complex typed (Java).
Re:The Evolution of a Haskell Programmer (2001) by DonaldFisk on Monday February 08, 2016 @04:48PM (#11061123)
He's assuming that the language the code was written in was strongly typed, and that unit tests were actually written. That is not always the case.
Re:The Evolution of a Haskell Programmer (2001) by ktRolster on Monday February 08, 2016 @05:52PM (#11061535)
He's saying that a strongly typed language with unit tests is not enough to prevent bugs. And he's right.
Re:The Evolution of a Haskell Programmer (2001) by DonaldFisk on Monday February 08, 2016 @07:15PM (#11062009)
Strongly typed languages, and unit testing, do prevent or detect many kinds of bugs less expensively than the alternatives. That is why they're worth using.

Similarly, not all diseases are prevented by vaccination, but that's not considered a good argument to stop vaccinating people against those diseases that are prevented by vaccination.

Re:The Evolution of a Haskell Programmer (2001) by ktRolster on Monday February 08, 2016 @09:09PM (#11062557)
I agree with you, but you're being argumentative. No one here is saying that we should stop unit tests because they can't find all the bugs.

Instead, the focus should be on what else we can do to improve the bug detection rate. This is an area that needs further research (and I would start with the observation that the quality of the unit test varies dramatically depending on who writes them).

Re:The Evolution of a Haskell Programmer (2001) by bribri on Tuesday February 09, 2016 @01:04PM (#11067277)
The debate on dynamic vs strong is more important than testing vs no testing.
Re:The Evolution of a Haskell Programmer (2001) by ktRolster on Tuesday February 09, 2016 @02:56PM (#11068269)
Why? Explain yourself.
Re:The Evolution of a Haskell Programmer (2001) by hellofunk on Monday February 08, 2016 @05:54PM (#11061552)
Yes, this was the point of his quote. Strange how this point was missed in the other comments. Of course, Hickey is aware that not all languages are strongly typed.
Re:The Evolution of a Haskell Programmer (2001) by eru on Monday February 08, 2016 @06:07PM (#11061636)
There might still be far fewer bugs.
Re:The Evolution of a Haskell Programmer (2001) by kbenson on Monday February 08, 2016 @06:07PM (#11061640)
There's always at least one type checker, the one running in your head. Some languages provide another type checker to help offload some of this cognitive load.
Re:The Evolution of a Haskell Programmer (2001) by jacalata on Monday February 08, 2016 @04:21PM (#11060981)
I see you've never worked in vanilla JS.