design patterns

20
Design Patterns Removing Pain From Design Erik Peterson

Upload: kesler

Post on 15-Feb-2016

16 views

Category:

Documents


0 download

DESCRIPTION

Design Patterns. Removing Pain From Design. Erik Peterson. Ducks!. Interfaces. Interface Segregation Principle. What about other birds?. Adapter Pattern. Wraps the interface of one class into an interface that can be used by a specific client. What the flock?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Design Patterns

Design PatternsRemoving Pain From Design

Erik Peterson

Page 2: Design Patterns

Ducks!

Page 3: Design Patterns

Interfaces

Interface Segregation Principle

Page 4: Design Patterns

What about other birds?

Page 5: Design Patterns

Adapter Pattern

Wraps the interface of one class into an interface that can be used by a specific client

Page 6: Design Patterns

What the flock?Now we need a way to count all of these birds…

Page 7: Design Patterns

Decorator Pattern

Allows additional behavior to be added to a class dynamically

Page 8: Design Patterns

How to build a duck

Now we have two types:• Quackable• Countable

Page 9: Design Patterns

FactoriesEncapsulate object creation

Page 10: Design Patterns

Abstract Factory Pattern

Used to represent a group of factories that can create a common element

Page 11: Design Patterns

About that flock…

We need a way to go through the flock and check up on each bird, but how?

Page 12: Design Patterns

Iterator Pattern

Encapsulates how to navigate an aggregate sequentially without exposing its internal structure

Page 13: Design Patterns

Another way of changing behavior

Different ducks behave in different ways

Some might even migrate to different locales in the winter!

Page 14: Design Patterns

Template Method Pattern

Allows an inherited class to change the behavior on a base class by implementing an abstract (or virtual) method on the base

Page 15: Design Patterns

Managing the BarnOur farmers want a way of easily managing the basic tasks around the barn…

… introducing the Barn Automator 3000 Deluxe!

Page 16: Design Patterns

Command Pattern

Encapsulates requests, allowingthe consumer to take in differenttypes of commands

Page 17: Design Patterns

Bringing Order to ChaosWe now have a lot of birds, but how do we sort them?

Page 18: Design Patterns

Strategy Pattern

Encapsulates an algorithm away from a client so that they can be interchangeable

Page 19: Design Patterns

Buy this book!

Page 20: Design Patterns

Me:Erik [email protected]://erikbase.blogspot.com

Don’t Forget:Evaluations: http://codecamp.phillydotnet.org/2009-1/Lists/Code%20Camp%20Evaluation

After party @ Shanachie in Ambler