Download presentation
Presentation is loading. Please wait.
Published byDarcy Doyle Modified over 8 years ago
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..*
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.