Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Design Patterns

Boynux
March 05, 2014
210

Design Patterns

Boynux

March 05, 2014
Tweet

Transcript

  1. Eric Gamma “I think patterns as a whole can help

    people learn object-oriented thinking: how you can leverage polymorphism, design for composition, delegation, balance responsibilities, and provide pluggable behavior.”
  2. Richard Helm “The goal for most software developers still remains

    to design for change — and there the debate is do you do it early or later? In many cases the design should be re-factored, and the patterns provide a target to do this.”
  3. Ralph Johnson Most programmers are not hired to write reusable

    software, except in the sense that the software needs to be usable years later, when requirements change and the world is a different place. On the other hand, they need to know how reusable software works, and our patterns are common in reusable software, so they are still useful for the average programmer to know.
  4. Factory Method (class) “Define an interface for creating an object,

    but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.”
  5. Chef Abstract Italian Iranian Indian Customer Abstract Italian Iranian Indian

    Make me Some food AH! @#$!@ Factory Method Mi fanno un po 'di cibo. Sì, signore! زبپ اذغ مارب هفیعض اقآ ،مشچ OK! 0100100011 1100100100
  6. Abstract Factory (object) “Provide an interface for creating families of

    related or dependent objects without specifying their concrete classes.”
  7. Where is my the Chef? Hey Chef, make me some

    food! Italian Indian French Today's cuisine is French! Client Concrete Product Abstract Factory Abstract Factory
  8. Builder Pattern Separate the construction of a complex object from

    its representation so that the same construction process can create different representations.
  9. Italian Chef Servant Add: Bread Sauce Pepperoni Tomato Cheese Get:

    Pitza Add: Dish Dish Cup Glass Get: Pile of Dishes Director Builder
  10. Adapter Pattern “Convert the interface of a class into another

    interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.”
  11. Composite Pattern “Compose objects into tree structures to represent part-whole

    hierarchies. Composite let's clients treat individual objects and compositions of objects uniformly.”
  12. Behavioral Patterns Interpreter Template Method Chain Of Responsibility Command Iterator

    Mediator Memento Observer State Strategy Visitor Class Object
  13. Observer Pattern Define a one-to-many dependency between objects so that

    when one object changes state, all its dependents are notified and updated automatically.
  14. State Pattern Allow an object to alter its behavior when

    its internal state changes. The object will appear to change its class.
  15. Strategy Pattern Define a family of algorithms, encapsulate each one,

    and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
  16. Visitor Pattern Represent an operation to be performed on the

    elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.