Re: imperative, and functional, and oo, ...
Posted: Jul 10, 2007 12:28 PM
> > There's been a lot of discussion here about the lack of
> > refactoring tools for dynamically typed languages, and
> > amount of confidence we can have in refactoring tools
> > statically typed languages, but ultimately, I think
> > one thing that dynamically typed languages have going
> > them today is ease of testing.
> That's an interesting statement.
> It seems to me that ease of testing doesn't have much to
> do with the language and everything to do with the
> programmer. A developer who is sensitive to the
> importance of testing will always come up with highly
> testable code, regardless of the language they program
Yes, it always comes back to programmers but the fact of the matter is, if you have a code base that was started by unenlightened programmers, or tended by unenlightened programmers, recovery is far harder in those languages than it has to be.
> I think that we're seeing more testable Ruby code than
> testable C++ code because Ruby is more recent, and
> developers who use it are part of a more recent generation
> that has been exposed to the importance of testing.
It's more than that. You don't have to retrofit interfaces or abstract classes, or peel final off of classes and methods; and it's easy to replace methods on classes or objects in a test-local way. Recovery is easier.
> Can you think of any features of certain dynamic languages
> that make them inherently more testable than, say, C++?
> (I can't at the moment, but I'll think about it some
The ones I just mentioned are a short list. Another advantage is turnaround time. Java is a lot better than C++ in this regard. There are systems with module interdependencies that would take months or years of non-stop development effort to fix just because of compile and link time. Dynamically typed languages have Java, C++, and C# beat in this regard.