3 ms·
Apology of the NULL pointer
- wlievens 16y agoI don't get why some people think null pointer exceptions are such a huge problem. Just apply design-by-contract in the right places and you're fine.
- DrJokepu 16y agoIn addition, in my experience, null pointer exception related bugs are typically the most easily debuggable bugs as they typically arise from some trivial programming error and not some kind of architectural mistake.
- olavk 16y agoNull pointer exception are bad because they typically are thrown in a different place than where the actual error occurs.
- wlievens 16y agoNot if you apply design-by-contract, that's the whole point.
- bad_user 16y agoI hate null pointers because library writers are misusing null pointers. One example I can think of: BeautifulSoup. If no search results are found within the document, it returns None or something similar. And when that happens somewhere in a whole chain of queries, you're ending up with an exception. This shouldn't happen ... I want the result of the whole chain queries to be NULL, and I don't care which link in that chain started it. So languages with Monad comprehensions (or dynamic OOP languages where you can override the runtime dispatching) ... have an advantage here because you can use the Maybe monad.