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.

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 >>

 

comments
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts