3 ms·
You can write good code without compile time type checking, but it requires so much more developer focus to avoid writing bugs than a language with type checkin
by kennywinker 4y ago
You can write good code without compile time type checking, but it requires so much more developer focus to avoid writing bugs than a language with type checking. Everything else, php’s “jankyness”, javascript’s mystifying truthyness tables, those are easily overcome
problems. Handing a string to a function expecting a number, and not finding out about it until that code actually runs? That’s the real problem, imo
- larve 4y agothanks for reading and commenting. I am incredibly bullish on static typing and static analysis in general. There are quite a few tools that bring these to PHP and JS (I am not entirely happy with PHPStan / Psalm, I am very pleased by Typescript). Before that, I have been using Jetbrains analysis tools. In web development, I find that there is a certain freedom that comes with dynamic typing that I wouldn't tolerate in other systems software (my other specialization is embedded software), as easy templating and logging are givens. The fact that so much in web can also be "caught" at runtime (monitoring, logging, tracing) changes the game quite a bit as well, giving dynamic typing a bit more breathing room.
- sgc 4y agoI think it's the fact there are no compile times (those runtime tools you are talking about are at your fingertips) that people historically have not worried as much about types in PHP and JS. In many cases it does just feel like verbose boilerplate rather than a useful tool. Type checking is just one of the many things you can test by hitting ctrl+R, and you will be doing that anyways to test everything else. (Obviously, the bigger the project, the less that is true, but that argument is well-known). Personally, I spend exponentially more time correcting my typos than my types, and auto-completion of previous used variables and functions is worth a lot more than a type system to me in my day to day. I will never argue against types, but unless I am working with somebody else, I don't need them.