|
|
|
|
|
by howdydoo
2912 days ago
|
|
In a parallel universe, a candidate who is worried about a divisor of zero has his head stuck in the tiny details and is unable to do big-picture thinking. Personally I've gone my entire career without seeing a divide-by-zero bug. It's the last thing on my mind. If it's possible for Z to be zero, it will be caught in CI before we deploy/cut a release. In your first snippet, would you expect a candidate to tell you that `f` might be undefined? |
|
No. Because I'd expect the candidate to focus on subtle issues, and not waste time on bleeding obvious ones!
Of course f() might be undefined. Blind Freddy knows that. But Blind Freddy can't necessarily see the other (much more subtle) problems in those 4 lines of code.
I want to know, is this candidate more than Blind Freddy? Does he inhabit what some of us call "the real world", where things like division by zero are things to be consciously managed by proper coding practices?
(Edits for clarity)