Hacker News new | ask | show | jobs
by ewmiller 2059 days ago
Dynamically typed, vanilla JS always seems like the faster option at first. Then your team grows, new developers inherit the project, and your codebase needs to be worked on at scale. This is when vanilla JS falls apart and becomes incredibly annoying to maintain, and it's why most of the big tech companies out there do not use vanilla Node JS for large projects.

Types are like living documentation - a contract between devs that describes and enforces specific behavior. Just because you know what properties an object contains now doesn't mean you'll remember it in a month, or that the dev who inherits your work will have an easy time figuring it out. I feel way faster when I code using types, because the type system tells me exactly what I'm working with at a given time. This ends up preventing lots of bugs and makes debugging errors that do happen way easier, in my experience.

So TL;DR types seem slower at first but the dividends are paid in full, and then some, when you have to maintain a project among many devs or teams of devs.

EDIT: not to mention that IDE autocomplete features often seem like a superpower when working with static types. I'd recommend Typescript for that reason alone, honestly.

1 comments

Relying on the type system for code insight and bug catching means one have not carefully studied the code, which is what causes most bugs. If the code base is too large for anyone to digest, then break up responsibility.