Five Minute Design Patterns - PowerPoint PPT Presentation

About This Presentation
Title:

Five Minute Design Patterns

Description:

The Adapter Pattern converts the interface of a class into another interface the ... The Fa ade Pattern provides a unified interface to a set of interfaces in a ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 21
Provided by: forestand
Category:
Tags: design | five | minute | patterns

less

Transcript and Presenter's Notes

Title: Five Minute Design Patterns


1
Five Minute Design Patterns
Template Factory Singleton Iterator Adapter Façade
Observer Command Strategy Decorator
  • Doug Marttila
  • Forest and the Trees
  • May 30, 2009

2
Design Patterns
  • WTF
  • Not a framework
  • 23 - not all applicable to Flash and Flex
  • Youve used them

3
Why Patterns Matter
  • Common language
  • CS is good for you
  • Speed up your development
  • Preexisting documentation
  • Refine your solutions
  • Explains the why

4
Best Practices?
  • Not really in this presentation
  • Beware patterns overload

5
Best Practices
  • Encapsulate what varies
  • Program to an interface (or super class)
  • Favor composition over inheritance
  • Inversion of Control
  • Hollywood principle

6
Categories of Patterns(Are these useful at all?
Not so much.)
  • Creational
  • Structural
  • Behavioral

7
Template
  • Define the skeleton (or invariant parts) of an
    algorithm in a method, while deferring some steps
    to subclasses.
  • Setup the big picture and leave the details to
    the person doing the work.

8
Factory
  • Define an interface for creating an object, but
    let the subclasses decide which class to
    instantiate. The Factory method lets a class
    defer instantiation to subclasses

9
Singleton
  • Singleton Pattern ensures a class has only one
    instance, and provides a global point of access
    to it.

10
Iterator
  • The Iterator Pattern provides a way to access the
    elements of an aggregate object sequentially
    without exposing its underlying representation

11
Adapter
  • The Adapter Pattern converts the interface of a
    class into another interface the clients expect.
  • Adapter lets classes work together that
    couldn'totherwise because of incompatible
    interfaces.

12
Façade
  • The Façade Pattern provides a unified interface
    to a set of interfaces in a subsystem. Facade
    defines a higher level interface that makes the
    subsystem easier to use.
  • Principle of Least Knowledge - talk only to your
    immediate friends

13
Observer
  • The Observer Pattern defines a one-to-many
    dependency between objects so that when one
    object changes state, all of its dependents are
    notified and updated automatically.

14
Command
  • The Command Pattern encapsulates a request as an
    object, thereby letting you parameterize other
    objects with different requests, queue or log
    requests, and support undoable operations.

15
Strategy
  • The Strategy Pattern defines a family of
    algorithms, encapsulates each one, and makes them
    interchangeable. Strategy lets the algorithm vary
    independently from the clients that use it.

16
Decorator - last one!
  • The Decorator Pattern attaches additional
    responsibilities to an object dynamically.
    Decorators provide a flexible alternative to
    subclassing for extending functionality.

17
More Patterns!!!
  • State
  • Composite
  • Bridge
  • Proxy
  • Interpreter
  • Builder
  • Abstract Factory
  • Memento
  • Prototype
  • Visitor
  • Mediator
  • Chain of Responsibility
  • Flyweight
  • MVC

18
Resources
  • Beerfug.com
  • http//www.forestandthetrees.com/designPatterns/
  • Head First Design Patterns (the best) Java
  • GoF (dry, but what started it all)
  • ActionScript 3 with Design Patterns (Lott,
    Patterson)
  • ActionScript 3.0 Design Patterns (Sanders,
    Cumaranatunge)

19
Thank You!
  • Doug Marttila
  • forestandthetrees.com
  • doug_at_forestandthetrees.com
  • beerfug.com
  • (first wednesday of every month, beer code)

20
FoT!
Write a Comment
User Comments (0)
About PowerShow.com