Patterns in a Security Alarm System SAS AGENDA














- Slides: 14
Patterns in a Security Alarm System (SAS) AGENDA Domain Model n The Patterns n – Iterator – Observer – Abstract Factory – Singleton
Security Alarm System (SAS) Domain Model Monitoring Authority Observable Item Notify() Window Room Temp Door Monitoring Co. Sensor Observes Break In Police Fire Triggers Thermostat Motion Detector Magnetic Switch Smoke Sensor Open Event EVENT Attach(Observer) Detach(Observer) Notify() Trigger() Notifies Break Event Temp Event Smoke Event Owner
ITERATOR PATTERN Applicability n n Access an aggregate object's contents without exposing its internal representation. Support multiple traversals of aggregate objects.
ITERATOR PATTERN
ITERATOR PATTERN in SAS Iterator Abstract List Create. Iterator() Count() Append. Item() Remove. Item() First() Next() Is. Done() Current. Item() Zone List Sensor List Zone. Iterator Zone Sensor. Iterator Sensor
OBSERVER PATTERN Applicability When a change to one object requires changing others, and you don't know how many objects need to be changed. n When an object should be able to notify other objects without making assumptions about which objects they are. n
OBSERVER PATTERN
OBSERVER PATTERN in SAS EVENT Attach(Observer) Detach(Observer) Trigger() Monitoring Authority observers for all o in observers o. Notify() Open Event Notify() Break Event Temp Event Smoke Event Monitoring Co. Police Fire Owner
ABSTRACT FACTORY PATTERN Applicability A system should be independent of how its products are created, composed, and represented. n A system should be configured with one of multiple families of products. n
ABSTRACT FACTORY PATTERN
ABSTRACT FACTORY PATTERN in SAS Sensor Factory Create. Sensor() Create. Event() Break In Thermostat Motion Detector Magnetic Switch Smoke Sensor Window Sensor EVENT Attach(Observer) Detach(Observer) Trigger() Door Sensor Open Event Break Event Temp Event Smoke Event
SINGLETON PATTERN Applicability n There must be exactly one instance of a class, and it must be accessible to clients from a well-known access point.
SINGLETON PATTERN
SINGLETON PATTERN in SAS <<controller>> static my. Instance static get. Instance() return my. Instance














