Null references redux

Jeremie Pelletier jeremiep at gmail.com
Sat Sep 26 21:17:05 PDT 2009


Ary Borenszweig wrote:
> Daniel Keep wrote:
>>
>> Walter Bright wrote:
>>> Daniel Keep wrote:
>>>> "But the user will just assign to something useless to get around 
>>>> that!"
>>>>
>>>> You mean like how everyone wraps every call in try{...}catch(Exception
>>>> e){} to shut the damn exceptions up?
>>> They do just that in Java because of the checked-exceptions thing. I
>>> have a reference to Bruce Eckel's essay on it somewhere in this thread.
>>> The observation in the article was it wasn't just moron idiot
>>> programmers doing this. It was the guru programmers doing it, all the
>>> while knowing it was the wrong thing to do. The end result was the
>>> feature actively created the very problems it was designed to prevent.
>> A NPE is the thermonuclear option of error handling.  Your program blows
>> up, tough luck, try again.  Debugging is forensics, just like picking
>> through a mound of dead bodies and bits of fuselage; if it's come to
>> that, there's a problem.
>>
>> It's your leg dropping off from necrosis and the doctor going "gee, I
>> guess you're sick."
>>
>> It's the plane smashing into the ground and killing everyone inside, a
>> specialised team spending a month analysing the wreckage and saying
>> "well, this screw came loose but BUGGERED if we can work out why."
>>
>> Then, after several more crashes, someone finally realises that it
>> didn't come loose, it was never there to begin with.  "Oh!  THAT'S why
>> they keep crashing!
>>
>> "Gee, would've been nice if the plane wouldn't have taken off without 
>> it."
> 
> I like your analogies. :)

I also do, but try and picture a plane sophisticated to the point it can 
notice missing screws and ask yourself the following question: what is 
making sure such a screw detection system works correctly.

That's really just taking a problem and sending it to another team to 
solve, at the end of the day, it's still a problem. Besides, explosions 
are cool!



More information about the Digitalmars-d mailing list