OK, I’m doing exclusively Java for some years, so I might not be quite objective. I don’t have field experience with other languages than Java, so I might miss important stuff. Feel free to correct me, if so.
The question : “As a software company manager, or as an independent developer, would I make more money with static or dynamic typing languages ?“. OK, the correct question is “which approach would provide a greater productivity for my programmers ?”, but admit it, it’s catchy to talk about “the money” (you just have to admit that the money you gain depends only on your productivity)
.
Now, some definitions from wikipedia :
static typing : A programming language is said to use static typing when type checking is performed during compile-time as opposed to run-time. Examples include Java, C, C#, Haskel.
dynamic typing : A programming language is said to use dynamic typing when type checking is performed during run-time (also known as “late-binding”) as opposed to compile-time. Examples include Perl, Python, and Lisp, Ruby, Groovy.
And one assumption :
- the most important thing about a specific programming language is the “time to the market”. The time from the point where the customer is coming to me, up to the point where I deliver him with a correct working implementation, that’s the criteria I will choose one programming language or another. Of course, you will tell me about easiness to change the code later, but I’d say it’s already covered (if it’s fast to develop correct code, than most probably it will be simple to change).
Seems that there is an increasing interest around dynamic typing languages.
So, state of fact, I have to admit that dynamic typing would make me more proficient (because otherwise, nobody would use the dynamic approach, right
? ).
Now, I’m trying to understand that (remember, I’m doing Java, so by nature I find it very natural to use static typing). Dynamic typing allows me to write less code (some people, I don’t remember the link, is talking about 40% - 60 % less code). At the same time, it does move some errors from compile time to execution time. Execution time errors that are harder to find. I have to test all the possible paths for a program to find them all.
Bruce Eckel says that if you do automated testing, you have everything under control, and you don’t really need the safety of the compiler for your code not to fail at runtime. There is another guy here who has the same view. I am doing automated testing for some time. But I don’t think I will every be able to cover all paths in the code I write. There will always be things I’ve never exercised in my tests. Can I afford the program to crash with some stupid “the method is not there” error after I’ve delivered (while knowing that it would have been so simple to catch the error even at compile time) ?
Honest answer, I don’t know. Based on the experience I have till now (remember, Java only), I would say that I prefer to write 50% more code for the sake of things being clearly defined in the first place, and have everything fail often. Or maybe the fact that you don’t have to care about interfaces and stuff makes your life so easy that you can really devote more time to solving the problem and writing tests.
I guess I’ll just have to try for myself…