Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object Oriented Design Patterns - Creational Patterns

Similar presentations


Presentation on theme: "Object Oriented Design Patterns - Creational Patterns"— Presentation transcript:

1 Object Oriented Design Patterns - Creational Patterns
IMPORTANT NOTICE TO STUDENTS: These slides are NOT to be used as a replacement for student notes. These slides are sometimes vague and incomplete on purpose to spark class discussions. Object Oriented Design Patterns - Creational Patterns CS 360 Lecture 6

2 Have you ever written code and got the feeling you’ve solved that problem before?
Chances are you probably have! Write down your solution and refer to it when needed. This is the idea of a design pattern. Design Pattern: The re-usable form of a software solution. Optimized using good programming practices.

3 Object Oriented Design Patterns
Gang of Four (GoF) Book Most cited OO Design pattern book

4 Design Pattern Categories
Design Patterns Creational Ways to create objects Behavioral How objects interact with each other Structural How classes and objects are structured

5 Design Pattern Categories

6 Creational Design Patterns
Goal of Creational Design Patterns: Abstract the instantiation process. Helps make the system independent of how its objects are created, composed, and represented.

7 Creational Design Patterns - Singleton
Intent Ensure a class only has one instance, and provide a global point of access to it. Consequences Controlled access to a single instance of a class. The class then may provide access to other resources Reduced name space (reduced number of global variables)

8 Creational Design Patterns - Singleton

9 Creational Design Patterns - Prototype
Intent Specify the kinds of objects to create using a prototypical instance. Then create new objects by copying this prototype instance. Consequences Allows new objects by varying attributes Allows new object by varying structure Must implement the Clone operation

10 Creational Design Patterns - Prototype

11 Creational Design Patterns - Factory
Intent Define an interface for creating an object. Let subclasses decide which class to instantiate. Consequences Defers instantiation of objects to subclasses. Parent classes do not need to be concrete classes.

12 Project Group Activity
Search online content for Creational Design Patterns implemented using languages for your project. Singleton Prototype Factory

13 Web Development ACM SIG
Meeting today 4pm IEB Room 301


Download ppt "Object Oriented Design Patterns - Creational Patterns"

Similar presentations


Ads by Google