Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 4, Day 1: Singleton(s?) Singleton leftover Why singletons? How to make lazy initialization work multi- threaded? Observers Why observers? Class structure.

Similar presentations


Presentation on theme: "Week 4, Day 1: Singleton(s?) Singleton leftover Why singletons? How to make lazy initialization work multi- threaded? Observers Why observers? Class structure."— Presentation transcript:

1 Week 4, Day 1: Singleton(s?) Singleton leftover Why singletons? How to make lazy initialization work multi- threaded? Observers Why observers? Class structure for observers Lab Wednesday: Cumulative Quiz SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1

2 Why Singletons? Single interface to another program Website Database Data logging Any large object that you want to be static but intialize later SE-2811 Dr. Mark L. Hornick 2

3 Fixing the Locking Problem In-class example SE-2811 Dr. Mark L. Hornick 3

4 Why Observer? Events GUI Very good general structure for Decreasing coupling Increasing readability SE-2811 Dr. Mark L. Hornick 4

5 5 Basic class relationships Subject ------------------------------ attach():void detach():void notifyObservers():void Observer ---------------- update(???):void ObserverClass1 ObserverClass2 SubjectClass -observers 1..*


Download ppt "Week 4, Day 1: Singleton(s?) Singleton leftover Why singletons? How to make lazy initialization work multi- threaded? Observers Why observers? Class structure."

Similar presentations


Ads by Google