Null means *nothing* or *unknown*, depending on context.
18
votes
4answers
1k views
Just a lowly counter that turned out to be surprisingly complicated
While writing this review, I saw a need for a Counter object similar to Python's. It seemed like it would be easy to write such a class, but it turned out to be ...
14
votes
2answers
516 views
Using finally with return statement or not
I was wondering if it is the proper way to always put the return statement of a function with a try-catch clause in the finally ...
10
votes
2answers
216 views
Nullable<T> Implementation for VB6/VBA
Because I was spoiled with C# and the .NET framework, whenever I have to work with VB6 I feel like something's missing in the language. A little while ago I implemented a ...
9
votes
1answer
151 views
Organization data class
I believe I have made the following data class quite decently, and I'd like a thorough review on it.
The code is built on Java 8 and uses the Builder and Serialization Proxy pattern, it is used to ...
7
votes
5answers
575 views
Returning null or what?
I have a C# function like below, and in the else block, the function must return something. I don't know whether returning null is a good practice or not.
...
7
votes
1answer
88 views
PHP isset over use? Good or bad?
First, I'm in no way an experienced PHP coder. This is my 5th time working with PHP, so if you see anything that can bee improve, please point them out for me.
I have the code checking for the ...
6
votes
4answers
5k views
null/undefined checking for checking seats
This looks pretty messy (need to reduce nesting I feel). I need a check an input for a seat, but I can't guarantee it has a value (one may not be chosen for example). If the seats aren't in a certain ...
6
votes
2answers
154 views
How do I better structure Java code to avoid dereferencing null? [closed]
I have the situation where as long as the user gives valid input, the StringBuilder object will not be null.
...
6
votes
2answers
89 views
5
votes
2answers
303 views
Extension method to return a default value for any null value
I'm creating an extension method that can be used on any type. The idea is that if this method is called, it checks if value is null. If null, it needs to return a default instance of the specified ...
4
votes
2answers
167 views
Duplication with nested null checks
How can I improve this code with nested null check statements?
...
4
votes
4answers
227 views
Simplify Oracle SQL: Treat null date as 'N' and non-null date as 'Y'
This works, but nvl AND case seem redundant.
Basically, if null then 'N' else 'Y.
CHICKEN_HATCH_DATE is a DATE data type.
...
4
votes
4answers
616 views
Instantiating if null
I often have static classes which uses the DataContext somehow, and they all make a new DataContext, but often I already have ...
4
votes
1answer
109 views
Is checking for null redundant while using Contract Annotator from JetBrains?
I'm curious whether checking for null is redundant in this concrete example.
...
3
votes
3answers
222 views
Return value when the requested variable returns null
I have a method that returns a list from a HTML page:
...
3
votes
1answer
58 views
Should I null coalesce EventArgs?
When I implement events, it usually looks something like this:
...
3
votes
2answers
164 views
Null Object pattern with simple class hierarchy
I have a simple two-class hierarchy to represent U.S. ZIP (12345) and ZIP+4 (12345-1234) codes. To allow clients to allow both types for a field/parameter or restrict it to one type or the other, the ...
2
votes
3answers
235 views
Coding style preference if (aPtr), if (aPtr != NULL), or if (NULL != aPtr) [closed]
I understand that as far as the compiler is concerned, the following lines are equivalent.
if (aPtr) {...}
if (aPtr != NULL) {...}
if (NULL != aPtr) {...}
...
2
votes
3answers
147 views
Reduce cyclomatic complexity
How can I reduce cyclomatic complexity of validation and refactor it better way?
...
1
vote
2answers
175 views
A custom Java collection which doesn't support nulls
I am making a GWT application and have to prevent client code from using null values in collections.
I found an answer but GWT doesn't support Queue and its ...
1
vote
2answers
76 views
Reducing cyclomatic complexity in a simple string concatenation
I have written the following function that takes an address object and builds a string using the object properties. It will later be used to display a tooltip
...
1
vote
1answer
315 views
Handling nil: Trying to avoid #try
Yesterday, I introduced a bug into our codebase by calling #titleize on a string that could possibly come in as nil:
...
0
votes
6answers
484 views
Which Java string value is preferred to return: blank or null?
I came across this snippet and am wondering if I should return blank in this case.
Which is more practical to return: blank or ...
0
votes
0answers
13 views
Head is initiating to Null each time when the insert_node() function is calling in the linked list [closed]
Please Review the following code snippet. I am trying to insert elements into linked list using the double pointer concept.
Problem is:
Every time the 'Head' element is being assigned to 'NULL' ...
-2
votes
2answers
85 views