3 ms·
> you give up a certain level of developer productivity IMO the opposite is true; without types you give up some developer productivity in the form of time spe
by root_axis 9y ago
> you give up a certain level of developer productivity
IMO the opposite is true; without types you give up some developer productivity in the form of time spent writing tests and debugging issues that the type system would obviate automatically. In my view, loose typing adds the illusion of productivity because the developer might presume they are working faster because they don't have to reason about type restrictions, however they simply end up enforcing type restrictions manually (and relatively poorly compared to a solid type system) using "typeof" and "instanceof" checks throughout their code. In general, assigning multiple types to the same variable is considered a code smell anyway, so strict typing simply enforces what is already considered a best practice.
Of course, this doesn't mean that choosing typescript in particular is always the right engineering decision, but, all other things being equal, a strict type system is almost always preferable to a loose one.
- cloakandswagger 9y agoMaybe it just depends on the application. I've been doing frontend development with React and vanilla Javascript for the past 2.5 years, and I can't recall a single user-facing bug caused by improper dynamic typing.
- root_axis 9y agoI would push back on the idea that it depends on the application, I think what's more likely happening is that your experience has codified best practices that help to minimize these types of bugs, but you're still manually doing the work to protect against these error with typeof/instanceof and unit tests that validate input parameters.