DEV Community

Discussion on: Unhealthy Code: Null Checks Everywhere!

 
kopseng profile image
Carl-Erik Kopseng

Immutable code where you can drop all null checking is fantastic to work with. And I have been using the Null object (/DefaultObject pattern) for a decade in various settings. Still does wonders for avoiding nasty NPEs in Java and works quite well in JS as well, though I am pragmatic: I do not create a full 1:1 mapping for every class. Just the ones where it makes sense.

Thread Thread
 
dimpiax profile image
Dmytro Pylypenko

Hi, the talk in my comments is not about mutability , but about clean and not overused code with default values where execution must be terminated, but not being executed with empty values.