Null object pattern: Difference between revisions

Content deleted Content added
m Criticism: punct.
Changes of wording in sentences.
Line 31:
{{Unreferenced section|date=June 2023}}
 
Instead of using a [[null reference]] to convey the absence of an object (for instance, a non-existent customer), one uses an object which implements the expected [[Interface_(computing)#In_object-oriented_languages | interface]], but whose method body is empty. A key purpose of using a null object is to avoid conditionals of different kinds, resulting in code that is more focused, and quicker to read and follow{{snd}} i.e. improved readability.
One advantage of this approach over a working default implementation is that a null object is very predictable and has no side effects: it does ''nothing''.