4 ms·
Can I try giving a non-IDE example? I rarely use IDEs, but compile-time checks are super useful for me during refactoring. Sometimes I need to rename a class,
by revvx 7y ago
Can I try giving a non-IDE example?
I rarely use IDEs, but compile-time checks are super useful for me during refactoring.
Sometimes I need to rename a class, a method name or a method signature that is used all over the program. I could use tests, but the compiler is much faster and much more comprehensive. So I change everything in one go and then only run the tests after that.
The speed in itself is great, and helps me get much faster feedback than I can get with tests. It's also great during explorational programming, or during the prototype phase: some errors can be detected during compilation, so I'm not greeted with an easily avoidable runtime error.
As for an example of a bug that would have been prevented by compile-time checking, I had one happen just last week. It was in a project with 100% test coverage, but we had undetected refactoring errors due to a lack of integration testing: there were (good) unit tests with mocks, but we missed them during refactoring, triggering a runtime error in production. We fixed that by writing a few simple integration tests and fixed the code. This happened just last week. No biggie, but would be avoided by a compiler.
- latch 7y agoYour first example has _nothing_ to do with static or dynamic typing. There are plenty of dynamic languages that will fail to compile or bootup with a helpful error message on a failed rename. This is what's frustrating about trying to have this discussion (and it's covered in the article): "The problem, in this case, is that most programmers have limited experience, and haven’t tried a lot of languages." If you've used JavaScript and you assign all of the challenges of writing JavaScript to dynamic typing, then ya, dynamic typing sucks. But the problem isn't dynamic typing, the problem is JavaScript.
- revvx 7y agoIn the first example I was merely answering the grandparent. They mentions that people talk about the advantages of compile-time checking but fail to give examples. I'm merely giving an example that other people failed to give them. > This is what's frustrating about trying to have this discussion (and it's covered in the article): "The problem, in this case, is that most programmers have limited experience, and haven’t tried a lot of languages." Friend, this is completely uncalled for. A single HN answer doesn't say anything about my experience with multiple languages.