4 ms·
Above 10k lines is where statically typed languages really begin to justify their overhead. I work primarily in Ruby, C++ and Java, and while for smaller proje
by wheels 10y ago
Above 10k lines is where statically typed languages really begin to justify their overhead. I work primarily in Ruby, C++ and Java, and while for smaller projects, Ruby is far more of a joy to use, for large projects (I've worked on C++ projects well over a million lines of code) static typing is a blessing.
Refactoring Ruby is painful in a large project, even with decent test coverage (and a large portion of the tests basically enforce what you'd get automatically with static typing). C++ is doable in that you'll get (increasingly humane with clang and recent GCCs) compiler errors when you've forgotten some detail. But refactoring Java is positively germane with all of the tools that are enabled by such a consistent VM-model. (It really is neat to be able to rename a method in an object on 100k LOC project simply by renaming it in one place or to change a signature with helpers along the way.)
Some of that makes those languages less fun (and quick) to work with initially, but for projects that are likely to eventually grow quite large, there can be an eventual pay-off.
- sytse 10y agoGitLab is 30k+ lines of Ruby code http://gitlab-org.gitlab.io/gitlab-ce/coverage-ruby/#_AllFiles http://gitlab-org.gitlab.io/gitlab-ce/coverage-ruby/#_AllFil... We're not missing static typing as far as I know. We still are able to ship a lot of changes every month. I'm not sure if it is our structure (idiomatic Rails), test coverage (over 85%), something else, or maybe we should miss it but don't realize it. One disadvantage is that static typing causes more lines of code than dynamic code. And code size is the best predictor of code quality http://blog.vivekhaldar.com/post/10669678292/size-is-the-best-predictor-of-code-quality http://blog.vivekhaldar.com/post/10669678292/size-is-the-bes...
- adamnemecek 10y ago> One disadvantage is that static typing causes more lines of code than dynamic code. Not if the statically typed language uses inference.
- sytse 10y agoThat would be the best of both worlds indeed. Hope we get this for Ruby https://codon.com/consider-static-typing https://codon.com/consider-static-typing
- saurik 10y agoThe seminal languages with static typing had this feature, so I feel it does the field a disservice to say "the best of both worlds": there are a few annoyingly popular statically typed languages which don't have this property, and they should be considered deficient to the extent to which it is not for theoretical type depenence reasons.
- adamnemecek 10y agoWhat kills me about it refactoring c++ is dealing with headers. A lot of times, something should really be a separate file (or should me merged into another file) but it would be a pain in the ass to fix the headers.
- webkike 10y agoThis is a core problem with C++. Until we have packages, you might want to consider another language. Rust is usually a good choice.