PH page 18-24 GoF Singleton p. 127-134 Emanuel Ekstrom.

Slides:



Advertisements
Similar presentations
Creational Design Patterns. Creational DP: Abstracts the instantiation process Helps make a system independent of how objects are created, composed, represented.
Advertisements

Chapter 5: The Singleton Pattern
Design Patterns based on book of Gang of Four (GoF) Erich Gamma, Richard Helm, Ralph Johnson, and John VlissidesGang of Four (GoF) Elements of Reusable.
Visibility Larman, Chapter 19 (with ideas from George Blank of NJIT) CSE432 Object Oriented Software Engineering.
Design Patterns Section 7.1 (JIA’s) Section (till page 259) (JIA’s) Section 7.2.2(JIA’s) Section (JIA’s)
Matt Klein 7/6/2009.  Behavioral Pattern  Intent  Allow an object to alter its behavior when its internal state changes. The object will appear to.
. Plab – Tirgul 12 Design Patterns. Design Patterns u The De-Facto Book on Design Patterns:
Patterns Lecture 2. Singleton Ensure a class only has one instance, and provide a global point of access to it.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
1 Scenario: Audio Clip Imagine that your application played an audio clip Based on user action, a different audio clip may begin playing You want only.
עקרונות תכנות מונחה עצמים תרגול 9 – Design Patterns.
1 PH Chapter 1 (pp. 1-10) GoF Composite Pattern (pp ) PH Ch 2 through Fundamentals (pp ) Presentation by Julie Betlach 5/28/2009.
Singleton Christopher Chiaverini Software Design & Documentation September 18, 2003.
Design Patterns. Now you are ready for Design Patterns Design patterns are recurring solutions to software design problems you find again and again in.
Design patterns. What is a design pattern? Christopher Alexander: «The pattern describes a problem which again and again occurs in the work, as well as.
1 GoF Template Method (pp ) GoF Strategy (pp ) PH Single User Protection (pp ) Presentation by Julie Betlach 6/08/2009.
ECE 452 / CS 446 / SE464 Design Patterns: Part 2 - Answers A Tutorial By Peter Kim Partially based on the tutorial by Michał Antkiewicz.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Design Pattern. The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all.
Computer Science 313 – Advanced Programming Topics.
Computing IV Singleton Pattern Xinwen Fu.
Design Patterns CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
Patterns in programming1. 2 What are patterns? Answers to common design problems. A language used by developers –To discuss answers to design problems.
1 More OO Design Patterns CSC 335: Object-Oriented Programming and Design.
Design Patterns Yonglei Tao. Design Patterns  A design pattern describes a recurring design problem, a solution, and the context in which that solution.
Proxy, Observer, Symbolic Links Rebecca Chernoff.
Programmeerimine Delphi keskkonnas MTAT Programmeerimine Delphi keskkonnas MTAT Jelena Zaitseva
The Singleton Pattern SE-2811 Dr. Mark L. Hornick 1.
Design Patterns By Mareck Kortylevitch and Piotreck Ratchinsky.
Design Pattern. Definition: A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
Stéphane Ducasse 1 Singleton.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 6: Using Design Patterns.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
CS212: Object Oriented Analysis and Design Lecture 38: Design Pattern-II.
Design Patterns Introduction
Design Patterns SE464 Derek Rayside images from NetObjectives.com & Wikipedia.
Package A package is a logical container that contains classes,interfaces sub packages. Package provide a unique name space to its members and provide.
Singleton Pattern Presented By:- Navaneet Kumar ise
1 More OO Design Patterns CSC 335: Object-Oriented Programming and Design.
Singleton Pattern. Problem Want to ensure a single instance of a class, shared by all uses throughout a program Context Need to address initialization.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
Notes Over 1.6 Solving an Inequality with a Variable on One Side Solve the inequality. Then graph your solution. l l l
Singleton C ++ Design Patterns: Singleton in Detail Kutsyk Vasyl.
1 Creational Design Patterns CSC 335: Object-Oriented Programming and Design.
1 Lecture Material Design Patterns Visitor Client-Server Factory Singleton.
Solving Linear Systems by Substitution
Unit II-Chapter No. : 5- design Patterns
UML Class Diagrams (more notation)
Design Patterns (Chapter 6 of Text Book – Study just 8)
The Singleton Pattern SE-2811 Dr. Mark L. Hornick.
WARNING These slides are not optimized for printing or exam preparation. These are for lecture delivery only. These slides are made for PowerPoint 2010.
Intent (Thanks to Jim Fawcett for the slides)
Multiuser Protection and the Mediator Pattern
State Design Pattern 1.
Introduction to Design Patterns Part 1
עקרונות תכנות מונחה עצמים תרגול 9 – Design Patterns
Object Oriented Design Patterns - Creational Patterns
CSE 432 Presentation GoF: Factory Method PH: “To Kill a Singleton”
What is Singleton Category: Creational pattern
Singleton Pattern Pattern Name: Singleton Pattern Context
Singleton design pattern
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
Lecture 4: templates + singletons
CS 350 – Software Design Singleton – Chapter 21
Which best describes the relationship between classes and objects?
Design pattern Lecture 6.
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
עקרונות תכנות מונחה עצמים תרגול 7 – Design Patterns
Presentation transcript:

PH page 18-24 GoF Singleton p. 127-134 Emanuel Ekstrom

Orphans & Adoption Context: Making a file system. Three objects: Node, File, Directory. Why do we need to adopt? Why do we need to orphan? Who gets an adopt/orphan interface? So are they all the same?

Singleton Intent: ”Ensure a class only has one instance, and provide a global point of access to it.”

Discussion Who needs only one instance? What is good about a global access point? Why not global variables instead?

How do we make a Singleton? (GoF p. 131) Constructor protected Public static Instance() function. Is this enough?

Discussion What if we want to delete a Singleton? What if a deleted Singleton is called? Is there a solution to the problem?

Subclassing Problem: Making sure the subclasses are unique and that the clients can access it. How is this solved? Drawbacks?