Presentation is loading. Please wait.

Presentation is loading. Please wait.

Patterns in a Security Alarm System (SAS) AGENDA Domain Model Domain Model The Patterns The Patterns –Iterator –Observer –Abstract Factory –Singleton.

Similar presentations


Presentation on theme: "Patterns in a Security Alarm System (SAS) AGENDA Domain Model Domain Model The Patterns The Patterns –Iterator –Observer –Abstract Factory –Singleton."— Presentation transcript:

1 Patterns in a Security Alarm System (SAS) AGENDA Domain Model Domain Model The Patterns The Patterns –Iterator –Observer –Abstract Factory –Singleton

2 Observable Item Sensor Observes Triggers Notifies Room Temp DoorWindow Break InThermostatMotion Detector Magnetic SwitchSmoke Sensor Open EventTemp EventBreak EventSmoke Event Monitoring Co.PoliceOwnerFire EVENT Attach(Observer) Detach(Observer) Notify() Trigger() Monitoring Authority Notify() Security Alarm System (SAS) Domain Model

3 ITERATOR PATTERN Applicability Access an aggregate object's contents without exposing its internal representation. Access an aggregate object's contents without exposing its internal representation. Support multiple traversals of aggregate objects. Support multiple traversals of aggregate objects.

4 ITERATOR PATTERN

5 Abstract List CreateIterator() Count() AppendItem() RemoveItem() ITERATOR PATTERN in SAS Sensor List Zone List Sensor Iterator First() Next() IsDone() CurrentItem() SensorIterator ZoneIterator Zone

6 Applicability When a change to one object requires changing others, and you don't know how many objects need to be changed. When a change to one object requires changing others, and you don't know how many objects need to be changed. When an object should be able to notify other objects without making assumptions about which objects they are. When an object should be able to notify other objects without making assumptions about which objects they are. OBSERVER PATTERN

7

8 EVENT Attach(Observer) Detach(Observer) Trigger() OBSERVER PATTERN in SAS Open EventTemp EventBreak EventSmoke Event Monitoring Co.PoliceOwnerFire observers for all o in observers o.Notify() Monitoring Authority Notify()

9 Applicability A system should be independent of how its products are created, composed, and represented. A system should be independent of how its products are created, composed, and represented. A system should be configured with one of multiple families of products. A system should be configured with one of multiple families of products. ABSTRACT FACTORY PATTERN

10

11 EVENT Attach(Observer) Detach(Observer) Trigger() ABSTRACT FACTORY PATTERN in SAS Open EventTemp EventBreak EventSmoke Event Sensor Break InThermostatMotion Detector Magnetic SwitchSmoke Sensor Sensor Factory CreateSensor() CreateEvent() Door Sensor Window Sensor

12 Applicability There must be exactly one instance of a class, and it must be accessible to clients from a well-known access point. There must be exactly one instance of a class, and it must be accessible to clients from a well-known access point. SINGLETON PATTERN

13

14 SAS > static getInstance() SINGLETON PATTERN in SAS return myInstance static myInstance


Download ppt "Patterns in a Security Alarm System (SAS) AGENDA Domain Model Domain Model The Patterns The Patterns –Iterator –Observer –Abstract Factory –Singleton."

Similar presentations


Ads by Google