I came across an old post from Bruce Eckel about his experiences with Python (my favorite scripting language) and how it’s shaped his opinion of strong typing. Instead of using strong typing, he suggests using loose typing and strong testing.
But without a full set of unit tests (at the very least), you can’t guarantee the correctness of a program. To claim that the strong, static type checking constraints in C++, Java, or C# will prevent you from writing broken programs is clearly an illusion (you know this from personal experience). In fact, what we need is Strong testing, not strong typing.
A very interesting read, especially considering his strong involvement in C++ and Java over the past 20 years or so.
2 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
Yeah, I read this too, and when you think about all the issues surrounding quality control in software, the contract via interface is only one piece of the puzzle. In fact, most bugs are a result of errant behavior that has not been detected–and it cannot be detected in compile-time type checking. Strong testing allows you to verify the interface declarations, but more importantly it lets you verify behavior and track down buggy code that hides behind perfect interface definitions.
I think one other advantage it adds is being able to test your code for various exploits before someone in Russia behind an anonymous proxy decides to do it for you.