Jonathan Gros-Dubois
1 min readNov 20, 2021

--

JavaScript is not stupid. It has some gotchas, like any other language but it's proven itself to be pretty good at handling change over time. The JavaScript of today looks almost nothing like the JavaScript of 15 years ago and yet it never once broke backwards compatibility... Think about that. It's no coincidence; it was designed to be flexible. If browsers had been using TypeScript instead since the beginning, it would not have been able to evolve so much in such a seamless way.

Also it's no coincidence that the package managers of dynamically typed languages (e.g. npm) have so many more modules than those of statically typed languages. Modules written in dynamically typed languages are more composable because they tend to have simpler and more flexible interfaces and do not impose such rigid requirements on dependents. If you want to see what happens to a language ecosystem over decades with static typing, look at Java; it's extremely rigid. You need to read 5 pages of documentation to get anything done because every method expects some complex type instead of JavaScript methods which tend to accept mostly simple types such as IDs, strings, numbers, raw info objects (without methods or internal state), etc... It encourages proper encapsulation, high cohesion, loose coupling.

--

--

No responses yet