GoF Design Patterns-Object-Oriented Design-Lecture 20 Slides-Computer Engineering, Slides of Object Oriented Analysis and Design

GoF Design Patterns, Software Patterns, Factory Method, Abstract Factory, Builder, Prototype, Singleton, Raman Ramsin, Lecture Slides, Object Oriented Design, Department of Computer Engineering, Sharif University of Technology, Iran.

Typology: Slides

2011/2012

Uploaded on 02/19/2012

hester
hester 🇮🇷

4.5

(13)

84 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Department of Computer Engineering 1 Sharif University of Technology
Object-Oriented Design
Lecturer: Raman Ramsin
Lecture 20:
GoF Design Patterns Creational
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download GoF Design Patterns-Object-Oriented Design-Lecture 20 Slides-Computer Engineering and more Slides Object Oriented Analysis and Design in PDF only on Docsity!

Department of Computer Engineering

Sharif University of Technology

Object-Oriented Design

Lecturer: Raman Ramsin

Lecture 20 :

GoF Design Patterns – Creational

Department of Computer Engineering

Sharif University of Technology

Software Patterns  Software Patterns support reuse of software architecture and design.  Patterns capture the static and dynamic structures and collaborations of successful solutions to problems that arise when building applications in a particular domain.  Patterns represent solutions to problems that arise when developing software within a particular context.  i.e., “Pattern == problem/solution pair in a context”

Department of Computer Engineering

Sharif University of Technology

GoF Design Patterns: General Categories  23 patterns are divided into three separate categories:  Creational patterns  Deal with initializing and configuring classes and objects.  Structural patterns  Deal with decoupling interface and implementation of classes and objects.  Behavioral patterns  Deal with dynamic interactions among societies of classes and objects.

Department of Computer Engineering

Sharif University of Technology

GoF Design Patterns: Purpose and Scope

Department of Computer Engineering

Sharif University of Technology

Factory Method  Intent:  Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.

Department of Computer Engineering

Sharif University of Technology

Factory Method: Applicability  Use the Factory Method pattern when  a class can't anticipate the class of objects it must create.  a class wants its subclasses to specify the objects it creates.  classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate.

Department of Computer Engineering

Sharif University of Technology

Abstract Factory  Intent:  Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

Department of Computer Engineering

Sharif University of Technology

Abstract Factory: Applicability  Use the Abstract Factory pattern when  a system should be independent of how its products are created, composed, and represented.  a system should be configured with one of multiple families of products.  a family of related product objects is designed to be used together, and you need to enforce this constraint.  you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations.

Department of Computer Engineering

Sharif University of Technology

Builder  Intent:  Separate the construction of a complex object from its representation so that the same construction process can create different representations.

Department of Computer Engineering

Sharif University of Technology

Builder: Applicability  Use the Builder pattern when  the algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled.  the construction process must allow different representations for the object that's constructed.

Department of Computer Engineering

Sharif University of Technology

Builder: Collaborations

Department of Computer Engineering

Sharif University of Technology

Prototype  Intent:  Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.

Department of Computer Engineering

Sharif University of Technology

Prototype: Structure

Department of Computer Engineering

Sharif University of Technology

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