null-object-pattern

How can I make NHibernate aware of a first-class "Null Object", without database persistence?

I would like to make use of the Null Object pattern in my domain, but I don't want to have records in my database that relate to it - I would prefer it if NHibernate were able to map a SQL null value to my Null object, and vice versa. Is this possible (using Fluent NHibernate for mappings) P.S. This seems like it is a fairly common iss...

Good case for a Null Object Pattern? (Provide some service with a mailservice)

For a website I'm working on, I made an Media Service object that I use in the front end, as well as in the backend (CMS). This Media Service object manipulates media in a local repository (DB); it provides the ability to upload/embed video's and upload images. In other words, website visitors are able to do this in the front end, but a...

C++: Return NULL instead of struct

I have a struct Foo. In pseudocode: def FindFoo: foo = results of search foundFoo = true if a valid foo has been found return foo if foundFoo else someErrorCode How can I accomplish this in C++? Edited to remove numerous inaccuracies. ...

Is it feasible to create a NullObject for every class? ( with a tool of course )

The NullObjectPattern is intended to be a "safe" ( neutral ) behavior. The idea is create an object that don't do anything ( but doesn't throw NullPointerException either ) For instance the class defined as: class Employee { private String name; private int age; public String getName(){ return name; } public int get...

Null pattern with QObject

(C++/Qt) I have a smart pointer to a QObject. Let's say a QWeakPointer. For some external reason (something that might happen in another object or due to an event), it is possible that the pointed object gets destroyed. Since I have a smart pointer there will be no dangling reference, so there's no problem. But I always have to check if ...

Null Object Pattern to avoid Null checks?

Lately I have come across Null Object design pattern and my colleagues say it can be used to do away with the null pointer checks that are encountered throughout the code. for e.g suppose a DAO class returns information on Customer (in a value object called CustomerVO). My main class is supposed to extract the firstName and emailId and...