The compiler doesn’t help you find bugs
And lastly, having worked with Trow on a reasonably big desktop Python app, we wanted a strongly typed language. Writing real applications in Python requires a discipline that unfortunately most people (including myself) are unwilling to adhere to, and this easily leads to buggy and hard to maintain programs.
Well, Python is a strongly typed language. He probably means a statically typed language.
You have to be very diligent about unit tests and code coverage for every line of code, because you can’t rely on the compiler to catch errors for you.
Wrong. Yes, the compiler will catch errors. It will in fact catch the type of errors that make the language impossible to compile, syntax errors. In a language without a compiler, you would only see some errors when you reach that line of code and the interpreter tries to interpret that line, this is correct. Joe Shaw thinks that unit tests are there so that you make sure these errors gets caught before delivery. They aren’t. They will do that, sure, but you can do that in much easier ways. In languages like Python, which uses just-in-time byte-code compiling, you’d see that error as soon as the module is loaded. And to make sure you have none of them, you just run a tool like pyflakes regularly. It does what the compiler does: It checks for language errors. That means that if you wrote “tehn” instead of “then” you’ll get to know it. Does this require discipline? Well, no more so than to actually re-run the compiler, before you check in the code you just wrote, so I would say no.
We had been burned by this a bit, and wanted to get back to a strongly typed, but still easy to use language that integrated well with the desktop.
(Again, I assume he means statically typed languages). Well, yes, with statically typed languages it will catch the error if you try to treat a Foo-class object as a Bar-class object. This is not handled in dynamically typed languages. Why? Because it isn’t an error! That’s what the dynamic typing is all about. Does that mean that dynamic typing requires more discipline? Not at all. In fact, it’s the other way around. Static languages want you to be disciplined and set up big object hierarchies with well defined interfaces, and stick to them. But you don’t have to, because there are always ways of making the static language behave dynamically, like using pointers and type casting everywhere, and therefore invalidate the whole argument.
And guess what. Once again, the tests are not there to test this, although they certainly will.
So what are the tests there for? They are there to make sure the program works as intended. And your compiler can’t help you with that. Only testing can. And there is no substitute for testing, and you can’t avoid it. It’s just a matter of who is testing it to find the bugs, the developers or the end users. And if you let the end users do it, I suspect they won’t be happy. And it won’t be cheaper for you either.