David B. Held wrote: > Derek Parnell wrote: >> [...] >> This I suspect is why dynamic typed languages are proving popular, >> because you can get a 99% correct program shipped without having to spend >> 200% of the money available. > > The main problem I see with dynamically typed languages is simply that > they are too concise. That is fine for small-scale development with > just one or two programmers on a team who own the software for its > entire lifetime. When it comes to enterprise software, the author might > own the code for less than 6 months before they move on to another team > or get reorganized into a different area. Not only that, the software > most likely has to interact with other software, and people on other > teams must then understand its interfaces. > > Because dynamic languages explicitly leave out the details from the > interface, you have to rely on the documentation that the original > author didn't write to figure out how to use that software. You also > have to rely on the tests they didn't write to verify that it works > correctly. Static typing doesn't fix any of this by itself, but it does > prevent the stupid-but-all-too-common errors where you call a function > with the wrong number of arguments, transpose some arguments, etc. It > also self-documents what is generally expected for each function in the > interface and what kinds of objects will get constructed and passed > around.
Software written in dynamic languages won't scale without some more strict development process. Mandatory testing compensates for the lack of static typing and more. With testing you cover that part which the compiles does in static languages, but do it at runtime. > The more dynamic languages cater to large-scale development, the more > they begin to look like statically-typed languages. So the argument > that "it's faster to prototype with dynamic languages" is only relevant > for small-scale software, IMO. In every case I've seen where there is a > large system written in a dynamically typed language, I see a push by > the newer engineers to rewrite it in a statically typed language, for > all the reasons I stated above. > > The economics of large-scale software engineering are such that writing > the code constitutes only a small portion of the time creating the > software. All that "burden" of writing types and making sure they match > is very, very small compared to the additional safety they provide in an > environment that will eventually be full of bugs by the time it hits > production. I have participated briefly in one large project written in Ruby (on Rails). For every bit of code tests must be written. Code coverage verifies that 100% of code is covered by these tests. The writing of tests and creating fixtures were maybe half the work. When you'd check in code that breaks testing, you had to stay in until you fixed it. When you do have a runtime bug, it is much easier to debug a dynamic language than a static language. Dynamic languages don't do type checking at compile time, but they usually do way more of it at runtime. This is point often not mentioned by it's critics. I think productivity was much better than it would have been in a static language, but testing was essential and considered part of the code. One of the benefits of this kind of development is that it becomes very easy to refactor and adapt to new demands. > Of course, that implies that for tasks which do not require a lot of > engineering, it is entirely appropriate and even advantageous to use a > dynamic language. This tends to be utility/infrastructure coding to > automate things in 1,000 lines or less. Perl is great as long as the > user of the Perl script is a programmer. > > So I think the whiner in the original article is missing the point. > Dynamic languages are not, as far as I can tell, taking over the > world... They mostly take up a small-scale niche where they can press > their strengths. I would be very surprised to hear about a large-scale > project in Python/Ruby/etc. (100k+ lines). > > Dave A large scale project in Ruby/Python of 100K+ lines is equivalent to say 1000K+ lines of Java/C# code. I'm not saying dynamic languages do scale as good as static languages, but you have to take these two points into account: 1) development in these languages must have a different methodology and 2) it's not just writing less lines of code that makes it more productive.