Daily Archives: July 8, 2014

Why do dynamic languages make it difficult to maintain large codebases?

Dynamic languages have costs associated with them that static languages don’t. Let me begin by saying that it is hard to maintain a large codebase, period. Big code is hard to write no matter what tools you have at your disposal. Your question does not imply that maintaining a large codebase in a statically-typed language is “easy;” rather the question presupposes merely that it is an even harder problem to maintain a large codebase in a dynamic language than in a static language. That said, there are reasons why the effort expended in maintaining a large codebase in a dynamic language is somewhat larger than the effort expended for statically typed languages.



Ryan Seifert‘s insight:
This article touches on a topic I have been wrestling with. I keep returning to a rule of thumb: if it is a prototype, under 300 lines of code, or a single (or very limited) use program; dynamic language is easily the best choice. There is a reflection point where static languages make maintaining code bases easier; but that point is much harder to define.

I find it interesting how some large projects written in Javascript have chose to attack the increase codebase issue. We have seen inclusion of type-checking (Typescript), modules (jQuery et all), and much stronger test suites. Many of these techniques are common in static languages and have been used to great success in maintaining codebases.

Unfortunately, the article does not touch on if and when a module rewrite would be useful. At which point does the overhead of leveraging a dynamic language incur a cost greater than a migration to a language easier to maintain or which a better tool set exists? The emergence of language agnostic testing frameworks have reduced this barrier substantially (assuming tests provide significant code coverage). I am interested in seeing if language migrations start to occur at a larger rate (perhaps as language-to-language conversion becomes more common). Quick, painless, and verifiable language migrations would be a great boon for any project.