Hacker News new | ask | show | jobs
by phil_kahrl 1466 days ago
I spent a couple of decades with static typing (mostly Java) before spending another 5 years doing nothing but JavaScript. I definitely, I initially like the freedom of dynamic typing and one could argue that as long as you have sufficient tests in place, one is not better than the other. In practice, when working on a team, dynamic typing tends to fall short because it's difficult to enforce the patterns that are needed to actually have a maintainable code base. With dynamic typing different opinions about what patterns should be used in dynamic typing has lead to chaos where each team has to invent their own versions of accepted patterns meaning that each development team becomes an island of their own invention. Human progress relies on organizing many individuals with the same purpose and same way of doing things, which is very difficult to do with dynamic typing.
2 comments

Can you give an example where static typing enforces a pattern? I feel like that problem exists at the human level, where language would not make a difference, but maybe I'm overlooking something.
Programming to interfaces not implentation is at least encouraged if not outright enforced.
Java doesn't count. Neither does C, Pascal, etc. Languages where the only role of types is bondage-and-discipline are not meaningful for comparison.
But "bondage-and-discipline" is the only advantage in my opinion. It's because you have new-grads, juniors, people rushing through tasks, people new to the code base, new to the language, that's why on larger projects at companies forced "bondage-and-discipline" languages are hard not to use.
lol, I find that metaphor apt for quite a few languages I've worked with!
Which languages count?