provided by: 
Originally published at Internet.comChain of Responsibility
Suppose that you are writing software to monitor a security system. Physically, the security system consists of sensing devices (motion detectors, smoke detectors...) that transmit status information to a computer. The computer's job is to log all status information, maintain a display showing current status information and transmit alarms in the event of an emergency.
One of the goals for the monitoring software is that it should be highly scalable. It should be able to work for a small retail store, an office building, a warehouse or a multi-building complex. That goal has implications for the way that you design the monitoring software.
To keep things simple, your monitoring program should instantiate an object for every sensor it is to monitor. This provides a simple way to model each sensor's state. To ensure scalability, an object responsible for an individual sensor should not assume anything about its environment, except that it is at the bottom level of a hierarchical organization.
The organization will include objects corresponding to such real world things such as rooms, areas, floors and buildings. Directly modeling the real world provides a straightforward way to display the status of different parts of buildings. It also allows the interpretation of a sensor's state to be based on its environment. For example, if the temperature of a closed room exceeds 180°F then you may want the fire sprinklers in just that room to turn on. If the temperature in an open area of a warehouse exceeds 150°F you may want to turn on the fire sprinklers over that area and the adjacent areas. On the other hand, if the temperature in a freezer exceeds 30°F, to may want to sound an alarm to let people know that that freezer is getting too warm...
Read article at Internet.com site