3 ms·
I'm sure typing prevents some bugs. But if I'm looking at the bugs we find in the JS projects I work on, only a very few would have been avoided with typing. Th
by kabes 7y ago
I'm sure typing prevents some bugs. But if I'm looking at the bugs we find in the JS projects I work on, only a very few would have been avoided with typing. The vast majority of bugs are about unsound business logic, wrongly understood requirements, etc.
- mruts 7y agoThat’s because the thousands of errors were manually fixed before committing. I’ve programmed professionally in both Haskell (strongly statically typed) and Racket (dynamically typed). The number of bugs I encountered at runtime with Haskell was very close to 0 per 1000 lines of code. For Racket on the other hand, I would get maybe 5-15 per 1000 lines. Most of these were easy to catch and never made it into production, so it really only wasted my time instead of making the app unstable. But there would be a few very stupid bugs that would have been easily caught with static typing on the unhappy/rare path that wouldn’t be found until weeks or months later. Nowadays, I try to avoid all jobs that use languages with dynamic typing on production software simply for the reason that they make me anxious and upset. Maybe everyone else is just so much better than me that they never produce typing relating bugs, but I kinda doubt it.
- sgt101 7y agoIf you have a super duper type system you can use it to prevent lots of bugs in business logic, and you can use it to do a lot of work for you - as a solver. There are levels of value in typing - bug finding, but then also communicating what you are up to to other people using / reading the code (including you in < 6 weeks time!)