1 / 5

Week 4, Day 1: Singleton(s?)

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. Why Singletons?. Single interface to another program Website Database

dirk
Download Presentation

Week 4, Day 1: Singleton(s?)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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

  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

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

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

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

More Related