View stunning SlideShares in full-screen with the new iOS app!Introducing SlideShare for AndroidExplore all your favorite topics in the SlideShare appGet the SlideShare app to Save for Later — even offline
View stunning SlideShares in full-screen with the new Android app!View stunning SlideShares in full-screen with the new iOS app!
Design Patterns in Java and .NET Tim Murphy Technical Specialist Mike Vogt Vice President of Architecture
Objective Show the usefulness of Design Patterns when developing applications and how they apply no matter what the platform.
Agenda History of patterns What are patterns Why are patterns important Explore 6 common patterns Anti-Patterns
History Of Patterns Gang Of Four POSA – Patterns of Software Architecture Patterns of Enterprise Application Architecture
What Are Patterns Pattern Name Problem Solution Consequences
Why Are Patterns Important Common vocabulary Repositories of common solutions
Factory Method Pattern Method for object creation Lets subclasses decide which classes to create
Decorator Pattern Attach additional responsibilities to an object dynamically Allows behavior to be added via “wrappers” Avoids extensive inheritance hierarchies cost() Whip cost() Mocha cost() DarkRoast
Adapter Pattern Allows a system to use methods that do not match their interface
Visitor Pattern A way of separating an algorithm from an object structure it operates on. One can add new operations to existing object structures without modifying those structures <<interface>> CarElement + accept(CarElementVisitor v) Wheel Engine Body Car
Composite Pattern Allows you to compose objects into tree structures to represent whole-part hierarchies. Lets clients treat individual objects and compositions of objects uniformly. <<interface>> Component + operation + add(Component c) + remove(Component c) + getChild(inti) Node Client Leaf Leaf Leaf Composite add, remove, getChild, operation Leaf + operation()
Anit-Patterns One pattern to rule them all Loosey Goosey
ResourcesDesign Patterns: Elements of Reusable Object-Oriented Software – Erich Gamma, Richard Helm, Ralph Johnson, and John VlissidesHead First Design Patterns – Eric Freeman and Elisabeth FreemanDesign Patterns In C# - Steven John Metsker