Null is the absence of a value. Null is typically used to indicate that a reference or pointer variable points to no object in memory.

learn more… | top users | synonyms

11
votes
10answers
1k views

Should security restrictions cause a service to return null or throw an exception? [closed]

I'm in a bit of a disagreement with a more experienced developer on this issue, and wondering what others think about it; our environment is Java, EJB 3, services, etc. The code I wrote calls a ...
20
votes
7answers
8k views

How does throwing an ArgumentNullException help?

Let's say I have a method: public void DoSomething(ISomeInterface someObject) { if(someObject == null) throw new ArgumentNullException("someObject"); someObject.DoThisOrThat(); } I've been ...
20
votes
13answers
3k views

Why are null references shunned while throwing exceptions is considered okay?

I don't quite understand the consistent bashing of null references by some programming language folks. What's so bad about them? If I request read access to a file that doesn't exist then I'm ...
4
votes
2answers
140 views

Best Way to Express Meta-Info on Missing Data?

I work in healthcare IT, reviewing data management processes of various observational studies. One problem I have repeatedly faced is the poorly encoded data, especially when some values are missing. ...
13
votes
11answers
18k views

Best way to handle nulls in Java? [closed]

I have some code that is failing because of NullPointerException. A method is being called on the object where the object does not exist. However, this led me to think about the best way to fix ...
7
votes
10answers
3k views

Property-coalescing operator for C#

The null-coalescing operator in c# allows you to shorten the code if (_mywidget == null) return new Widget(); else return _mywidget; Down to: return _mywidget ?? new Widget(); I ...
4
votes
8answers
2k views

How will you handle NULL values in your application?

At what level do you prefer to handle Null values in your application? My personal preference at the moment is the DB. When I build a view, I ensure that I return a value in place of a NULL value. So ...
51
votes
11answers
66k views

SQL: empty string vs NULL value

I know this subject is a bit controversial and there are a lot of various articles/opinions floating around the internet. Unfortunatelly, most of them assume the person doesn't know what the ...
99
votes
23answers
21k views

Are null references really a bad thing?

I've heard it said that the inclusion of null references in programming languages is the "billion dollar mistake". But why? Sure, they can cause NullReferenceExceptions, but so what? Any element of ...