[Haskell-cafe] Re: Dynamic typing makes you more productive?
haskell at list.mightyreason.com
Tue Mar 18 14:07:07 EDT 2008
Jules Bean wrote:
> Justin Bailey wrote:
>>> From a recent interview with the guy leading Ruby development on
>> .NET at Microsoft:
>> "You spend less time writing software than you spend maintaining
>> software. Optimizing for writing software versus maintaining software
>> is probably the wrong thing to do. Static typing makes it harder to
>> maintain software because it's harder to change it."
> It's interesting to say that, because not only is it completely untrue,
> but the opposite is in fact true. I would make the following statement:
> "Static typing makes it easier to maintain software because it's easier
> to change it".
It depends on type inferencing and tool support. If you change a type in Java
(or C++) then you will have to change its declaration at each point of use in
the project. This is only easy with tool support. In Ruby or Python there are
few declarations to change -- but you have to be sure it is safe.
In Haskell, the type inference meas there are few declarations to change -- and
it catches all the unsafe usages.
If you have many declarations then you are going to wish for more tool support.
> When you change the type of something in a program (be it statically
> dynamically typed) you have to change all uses of it. If your program is
> dynamically typed, you have to work very hard to make sure you catch all
> instances, perhaps by having an enormous test suite, perhaps by having a
> powerful IDE with semantically aware search and replace. A common source
> of bugs is making a partial change in this way, where a rarely-tested
> code path develops a semantic bug from a 'far-away change'.
> If your program is statically typed, the compiler tells you all the
> places you need to change. Job done.
> Therefore I find that generally speak change/refactoring is an order of
> magnitude easier in haskell than, say, ruby.
More information about the Haskell-Cafe