Saturday, January 21, 2006

Dynamic vs. Strong Type Systems

Dave Hoover, the "Red Squirrel" makes/collects some good observations here
(Dynamic languages + TDD) == (power + safety) == confidence.
Yes. Free your self from "hand-cuff" programming, and do your TDD.

Strong testing is fabulous, no doubt about it: the problem is that most developers don't have the discipline to write and update their test suites. The consequence is that, in the real world, there actually are benefits to static typing in complex projects. One way of thinking about static typing is as "just another test suite", except that it's a test suite developers are less likely be lazy about or subvert.


No, No, No. The compiler is no tester. I am still surprised to see how many developers measure their progress in lines of code compiled, and not in feature tested.(see Running Tested Features) Having the code compiled does not mean, that a function will not through an exception on a null pointer, or when an empty string comes as parameter. So where is the "TestSuite"? That the function accepts a string as parameter, and every caller supplies a string? This is very "thin" for a TestSuite.

The "safe language" argument appeals to fear, while the "flexible language" argument appeals to a sense of opportunity and adventure. Both are powerful motivations, so for a long time this argument has been a stalemate. Happily, that period is coming to an end. Two new factors have come into play: automated testing and transparency. Over the next five years they will turn the balance totally in the favor of more flexible languages.

:D I remember a quote about XP that the most methodologies are based on "fear", but XP is a methology is based on "fun". And there is no safe language, there are only tested programs. If somebody asks at the end of the day what have you done, you say: "I have 30 specifications, running, and I tested my code against them". If these specifications are good or wrong, that is another story, but at least you can say I can prove that for this 30 cases, my cod works.



No comments: