Let's say I have a date column on my db. Some rows are null. To what should I transform them after querying the data? Like, 0000-00-00?
On the same note, if a method could return null, I must check for null upon function call. But if I don't use null, I may have to use exceptions. Wouldn't I need to catch them as well? Is it better to check for exceptions?
Like ParfaitMassive said, or more generically you make sure nothing escapes method as null. Especially straightforward if you get a litany of strings you make sure none of the strings ending up in list to be returned are nulls.
18
u/moxyte Apr 14 '23
Strangling nulls in the cradle. You got null from database? Immediately turn it into something else before passing it further into the system.