DEV Community

Discussion on: Null Object Pattern

Collapse
 
craigbrad profile image
Craig Bradley

Yes, this solves the problem but doesn't really make it clear that we're dealing with null's in the constructor. I feel like the example in the post is not the best because it's just returning a value from the method. If the behaviour was more complex, then you might want to do something specific if the case where we have null. That's where the null object pattern really shines.