|
I thought the natural human reaction was to "poke-it-with-a-stick":
ChrisElston wrote: "What is it?"
"I don't know"
"Let's kill it" "Let's poke it with a stick."
Jack of all trades ~ Master of none.
|
|
|
|
|
JOAT-MON wrote: I thought the natural human reaction was to "poke-it-with-a-stick"
Isn't it to say that God made it this way?
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
..and yes of course I am an human 
|
|
|
|
|
I had a boss at one time like that. His code constantly crashed in production. It took the team over month with overtime, to fix one of his projects that he developed, using his leet and fast programming skills.
|
|
|
|
|
Which means you're permanently drunk and can't read the subject?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Are you a students of english?
|
|
|
|
|
Yes,but i english is bad,Please forgive me.
|
|
|
|
|
I really don't have any idea about what exactly defensive programming is 
|
|
|
|
|
Wiki[^]
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Let's say I build a function that takes an Object as parameter and the Object is Nothing/null... Don't you want/need to throw a ReferenceNullException? Not doing so and pretending everything went well seems like a code smell to me (and I've worked with code that does exactly that). If the programmer fails to Catch the Exception that's his problem, not mine. If the state of my Class/Library becomes inconsistent as a result of an Exception then that's my problem, but even more the programmer's who uses it
Maybe I'm misunderstanding the concept and I should take judo lessons...
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|
|
Totally agree - catch what you can handle otherwise bubble it up the call stack.
|
|
|
|
|
Right, but I don't think the question implied that.
I think that throwing a more descriptive Exception is what's needed there -- tell the caller which parameter was null.
|
|
|
|
|
The parameter that was supposed to tell the caller which parameter was null!
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|
|
Assuming the function's contract calls for a non-null parameter, I would throw an ArgumentNullException instead of the more general ReferenceNullException .
/ravi
|
|
|
|