top | item 8625467

(no title)

darrencauthon | 11 years ago

Yes, my gist, but also a Twitter conversation on how strong typing altered the need for tests. I've heard from a couple Haskell programmers about how the language practically eliminated the need for tests. I don't see how that's possible, but I also know Haskell.

I asked for a specific code example, and I threw out the scenario of a client who wants a contact us form that logs all responses and sends notification emails. I threw out a simple Ruby example where I tested the functionality, and I'm waiting to see the alternative.

discuss

order

tome|11 years ago

Haskell does not practically eliminate the need for tests. I am very concerned that Haskell programmers are getting the reputation for claiming such things because they're simply not true.

Haskell's type system does statically check many things you might want to write tests for which makes those particular tests unnecessary, but it doesn't eliminate the need for tests in general. If you hear any Haskell programmers making claims that sound like that please ask them to be more precise.

film42|11 years ago

Exactly! Even though haskell is pure, it's impure in the context of the complete system.

teacup50|11 years ago

Are you waiting to see the alternative, or waiting to be right?

The example given seems clear enough to extrapolate from.

darrencauthon|11 years ago

I'm waiting to see the alternative.

It's an honest question to ask in the face of an assertion about testing -- or how strong or static typing eliminates the need to verify that the code behaves as written. In the sample I provided, I provided a concrete example as to how I could verify that the code accomplishes the task. If tests are not needed, then fine... show me how with code that accomplishes the task and that show how.

Like the "unit" where the two operations are covered in one method... Sure, but how else would it be done? The client asked for the log and the email, so somehow, someway... someone has to write code to do it.

I threw up my Ruby sample in just a few minutes... why can't the alternative be coded up in a few more?