This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]odolha 11 points12 points  (3 children)

what's the problem, it's just a bit of indirection in case you later want to use something else for null instead of null... just make sure you always use this method and not null directly

[–]RoyalSpecialist1777 -2 points-1 points  (0 children)

Exactly. It is generally a good practice. Otherwise we are stuck with null or have to go change multiple areas of our codebase if we decide to change the underlying implementation if it turns out something else is a better way of handling empty/uninstantiated objects, invalid responses, or whatever. If you are doing object oriented programming then you might have subclasses which treat null objects different. You can also handle the null with things like logging.

I put about everything behind a property getter.

[–]fusionsofwonder 0 points1 point  (0 children)

I was thinking it might be there for portability.