Design Patterns GoF - PowerPoint PPT Presentation

1 / 39
About This Presentation
Title:

Design Patterns GoF

Description:

CoR,Command,Interpreter, Iterator, Mediator,Memento,Observer, State,Strategy, ... Prototype A fully initialized instance to be copied or cloned ... – PowerPoint PPT presentation

Number of Views:55
Avg rating:3.0/5.0
Slides: 40
Provided by: acar97
Category:
Tags: gof | cloned | design | fours | patterns

less

Transcript and Presenter's Notes

Title: Design Patterns GoF


1
Design Patterns(GoF)
  • Ilker Acar
  • MSP
  • Ilker.acar_at_msakademik.net

2
Agenda
  • Overview
  • Why Pattern?
  • Design Patterns
  • Creational Patterns
  • Structural Patterns
  • Behavioral Patterns
  • References

3
Overview
  • Pattern Best solution for a problem
  • 23 GoF Patterns, Gangs Of Fours
  • Creational Patterns (5)
  • Singleton,Abstract Factory, Factory Method,
    Builder, Prototype
  • Structural Patterns (7)
  • Adapter,Bridge,Composite,Decorator,Facade,Flyweig
    ht,Proxy
  • Behavioral Patterns (11)
  • CoR,Command,Interpreter, Iterator,
    Mediator,Memento,Observer, State,Strategy,
    Template Method, Visitor

4
Why Pattern?
  • Easy to Manage
  • Best Practices
  • Modification
  • Extensibility
  • Reusability

5
Creational Patterns
6
CP- 01 Singleton
7
CP- 01 Singleton(contd.)
  • Intent
  • Ensure a class only has one instance, and provide
    a global point of access to it.
  • Examples
  • Printer spooler, Window manager, File System,
    LoadBalancer

8
CP-O2 Abstract Factory (contd.)
  • Intent
  • Provide an interface for creating families of
    related or dependent objects without specifying
    their concrete classes.
  • Examples
  • Database Infrastructure, Windows/Web Forms

9
CP-O2 Abstract Factory (contd.)
10
CP- 03 Factory
  • 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.

11
CP-04 Builder
  • Intent
  •  Separates object construction from its
    representation

12
CP-05 Prototype
  • Intent
  • A fully initialized instance to be copied or
    cloned

13
Structural Patterns
14
SP-01 Adapter
  • Intent
  • Convert the interface of a class into another
    interface clients expect. Adapter lets classes
    work together that couldn't otherwise because of
    incompatible interfaces.

15
SP-02 Bridge
  • Intent
  • Separates an objects interface from its
    implementation

16
SP-03 Composite
  • Intent
  • A tree structure of simple and composite objects

17
SP-04 Decorator
  • Intent
  •  Add responsibilities to objects dynamically

18
SP-05 Facade
  • Intent
  • A single class that represents an entire
    subsystem

19
SP-06 Flyweight
  • Intent
  • Use sharing to support large numbers of
    fine-grained objects efficiently.

20
SP-07 Proxy
  • Intent
  • An object representing another object

21
Behavioral Patterns
22
BP-01 Chain of Responsibility
  • Intent
  • A way of passing a request between a chain of
    objects

23
BP-02 Command
  • Intent
  • Encapsulate a command request as an object
  • Examples
  • Undo/ Redo Operations

24
BP-03 Interpreter
  • Intent
  • Given a language, define a representation for its
    grammar along with an interpreter that uses the
    representation to interpret sentences in the
    language.

25
BP-04 Iterator
  • Intent
  • Sequentially access the elements of a collection

26
BP-05 Mediator
  • Intent
  •  Defines simplified communication between classes

27
BP-06 Memento
  • Intent
  •  Capture and restore an object's internal state

28
BP-07 Observer
  • Intent
  • A way of notifying change to a number of classes

29
BP-08 State
  • Intent
  •  Alter an object's behavior when its state
    changes

30
BP-09 Strategy
  • Intent
  •  Encapsulates an algorithm inside a class

31
BP-10 Template Method
  • Intent
  • Defer the exact steps of an algorithm to a
    subclass

32
BP-11 Visitor
  • Intent
  • Defines a new operation to a class without change

33
BP-11 Visitor (contd.)
34
Summary
  • Creational Patterns
  •  
  • Abstract Factory  Creates an instance of several
    families of classes  
  •  Builder    Separates object construction from
    its representation
  •  Factory Method   Creates an instance of several
    derived classes   
  • Prototype    A fully initialized instance to
    be copied or cloned  
  •  Singleton   A class of which only a single
    instance can exist

35
Summary (contd.)
  • Structural Patterns
  • Adapter    Match interfaces of different
    classes   
  • Bridge    Separates an objects interface
    from its implementation  
  • Composite   A tree structure of simple and
    composite objects   
  • Decorator    Add responsibilities to objects
    dynamically   
  • Facade    A single class that represents an
    entire subsystem   
  • Flyweight    A fine-grained instance used for
    efficient sharing   
  • Proxy    An object representing another
    object

36
Summary (contd.)
  • Behavioral Patterns
  • Chain of Resp.   A way of passing a request
    between a chain of objects  
  • Command    Encapsulate a command request as
    an object  
  • Interpreter    A way to include language
    elements in a program   
  • Iterator    Sequentially access the
    elements of a collection  
  • Mediator    Defines simplified
    communication between classes   
  • Memento   Capture and restore an object's
    internal state  
  • Observer    A way of notifying change to
    a number of classes
  • State     Alter an object's
    behavior when its state changes  
  • Strategy   Encapsulates an algorithm
    inside a class  
  • Template M. Defer the exact steps of an
    algorithm to a subclass  
  •  Visitor    Defines a new operation to
    a class without change

37
References / Useful Sources
38
Questions
  • ?

39
Thank You !
  • Ilker Acar
  • Microsoft Student Partner (MSP)
  • Contact
  • Mail ilker.acar_at_msakademik.net
  • Web http//www.ilkeracar.com
  • Blog http//iacar.spaces.live.com
Write a Comment
User Comments (0)
About PowerShow.com