Linked by Thom Holwerda on Thu 6th Sep 2012 18:07 UTC, submitted by MOS6510
General Development "Imagine an approach to programming where you write down some description of what your code should do, then before running your code you run some automatic tool to see if the code matches the description. That's Test-driven development, you say! Actually, this is what you are doing when you use static types in most languages too. Types are a description of the code's inputs and outputs, and the check ensures that inputs and outputs match up and are used consistently. Modern type systems - such as in Haskell or above - are very flexible, and allow these descriptions to be quite detailed; plus they are not too obtrusive in use and often very helpful."
Permalink for comment 534328
To read all comments associated with this story, please click here.
not just Haskell
by feydun on Sat 8th Sep 2012 04:36 UTC
feydun
Member since:
2012-02-27

But it's not an article about Haskell. If, like me, you know Haskell only vaguely and can't follow some of the examples it's still a very interesting read.
It's primarily about the power of types, how you can use them to provide some of the functionality of test-driven development and make programs more declarative and thus leave less room for bugs.

Like many people from a scientific computing background, I tend to care a lot about performance and don't mind if that means not writing in a very high level language. The irony is that in practice I spend much longer developing and debugging programs than executing them, and that's not even taking into account that while a calculation is running I can use my time on something else.
As the article shows, one aspect of high-level languages is that the higher degree of abstraction means you can express more about what you expect from the program, the point being that you'll spend less time tearing your hair out while explaining to an obtusely infuriating machine what you really meant to say.

Reply Score: 3