Week 4 day 1 singleton s
Download
1 / 5

Week 4, Day 1: Singleton(s?) - PowerPoint PPT Presentation


  • 139 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Week 4, Day 1: Singleton(s?)' - dirk


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
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

SE-2811

Slide design: Dr. Mark L. Hornick

Content: Dr. Hornick

Errors: Dr. Yoder


Why singletons
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


Fixing the locking problem
Fixing the Locking Problem

  • In-class example

SE-2811

Dr. Mark L. Hornick


Why observer
Why Observer?

  • Events

    • GUI

  • Very good general structure for

    • Decreasing coupling

    • Increasing readability

SE-2811

Dr. Mark L. Hornick


Basic class relationships
Basic class relationships

Subject

------------------------------

attach():voiddetach():voidnotifyObservers():void

Observer----------------

update(???):void

-observers

1..*

SubjectClass

ObserverClass1

ObserverClass2


ad