Resource

Null Object Design Pattern

Akkiraju Ivaturi Resources Sep 10, 2012
The null object pattern is a design pattern that simplifies the use of dependencies that can be undefined. This is achieved by using instances of a concrete class that implements a known interface, instead of null references.
  • 0
  • 0
  • 1478

The null object pattern is a design pattern that simplifies the use of dependencies that can be undefined. This is achieved by using instances of a concrete class that implements a known interface, instead of null references. 

"Unfortunately, using null tends to complicate the code." 

From the blog: 

"When you develop classes that have dependencies, you will sometimes have cases where a dependency is not needed, perhaps because the normal behaviour of the dependency is not required. One way to deal with such a situation is to use a null reference instead of a real object for that dependency. Unfortunately, using null tends to complicate the code. Wherever you need to use a member from the object, you must first check if it is null, as calling a method or accessing a property of a null reference will cause an exception." 

Continue reading here >>

 

COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

TOP RESOURCES

MOST LIKED RESOURCES