Hacker News new | ask | show | jobs
by wavemode 746 days ago
I once worked at a startup with a few hundred thousand LOCs of JavaScript (nodejs). We were in the process of evaluating TypeScript but were mostly still on plain JS.

The project had good test coverage. The main issue I had working in that codebase was never reliability, it was documentation. It's simply harder to read code that doesn't have types annotated. It takes longer to figure out what the shape of some certain data is, or is supposed to be.

Separately from that job, I've also worked with 1M+ LOC codebases in Ruby as well as Python. The Ruby codebase was statically typechecked with Sorbet and the Python with mypy. Big improvement to developer experience IMO.

It's common to ask, "why even use Ruby/Python and then typecheck it anyway?" But that question misses the point. The power of dynamic languages, in my opinion, isn't really that the types are dynamic. Rather, it is that the environment is dynamic. One thing this unlocks is that types and functions are just values and can be freely inspected, and created, at runtime. Another is that you can attach a REPL to a running system and inspect and debug it, live. Both of these allowed us to develop features and solve problems at a greater velocity than if we'd been working with a more static language.

1 comments

Thank you very much for your feedback and insights!

Two follow up questions:

You mention that functions/types are just values and can be created at runtime. IMHO you get the same with Java (8+) and everything running atop the JVM, Golang and some other programming languages. Why is this such a big differentiator for you?

The other thing I find interesting, that you didn't mention tooling at all. For me, navigation in bigger code bases is a killer feature ('one reads code more of ten than write it'). Code navigation/auto complete is IMHO much inferior in dynamic languages, even for small projects and with state of the art IDEs (IDEA...). (And not even mentioning deploying the software to servers/clients.) Did you find issues with the tooling in these projects, don't you care and just use VIM/Emacs or wasn't it just bothering you enough to mention?

> IMHO you get the same with Java (8+) and everything running atop the JVM, Golang and some other programming languages.

I mean... kind of? Java and Go both have reflection, sure. Creating types at runtime (e.g. for mocking) also kind of exists ... kind of. Though it's very hacky in both languages.

The REPL story is also much better in dynamic languages. I've seen production incidents get investigated, diagnosed and resolved in minutes, that would've taken hours at other companies.

Though of course with great power comes great responsibility. I've seen some abhorrent misuses of reflection, and I've seen issues caused by overuse of prod REPLs. It's all a tradeoff at the end of the day.

> Code navigation/auto complete is IMHO much inferior in dynamic languages

With type annotations, I've never had any problems with autocomplete or code navigation in Python (e.g. PyCharm, Python extensions for vscode, etc). Ruby either.

Without type annotations, you're gonna have a hard time.