Download presentation
Presentation is loading. Please wait.
2
Scott Cate (@ScottCate) CloudDB.com Session Code: DPR401
3
Design Patterns for the Rest of Us! DPR401 Patterns Patterns Patterns. You hear about them everywhere. We're told to use them and call them by names, as if the pattern is a colleague of ours. Hey, did you see the {Fill In Blank} Pattern in the demo this morning? If you feel left out in conversations where Pattern buzzwords are thrown around, this session is for you. This session introduces Patterns with imagery, code, terms, and fun and games to help you better understand and remember pattern usage.
4
Design Patterns Target audience for this talk You know the language very well You are an advanced programmer BUT ….. It’s difficult to explain what your code does Others tell you your code is hard to read Your code is buggy / hard to maintain Changing something little causes other unknowns YOU ARE NOT ALONE! IT IS HARD TO ADMIT THIS!
5
The Life Cycle of Bad Source Code Rewrite == expensive The original author is gone The code is hard to read Hard to understand functionality Cause to rewrite / replace Better code with patterns Proprietary == EXPENSIVE!
6
Where We Started! (Most of us)
7
OO Spaghetti Code Not my code, my code is good to me Is that because you wrote it? It’s in your head so you understand it Is the code hard to read / explain? Easy to get started with sloppy code but… It’s hard to add functionality later It’s hard to make core changes later
8
How We’ve Cleaned Up Our Code (Most of us)
9
Developing by Contract The unknown neighbor
10
Handling Change Requests Should be this easy
11
Building Blocks
12
What is a Design Pattern? (This is a legit question) No, it’s not a scary monster Proven Logical Techniques Tech communities agree on patterns (it’s hard to get people to agree) Common Vocabulary Easy to understand / inherit / read Just a term – not a golden solution
13
GOF: 3 Design Pattern Categories Dozens of more categories, these are GOF Creation How, Where, When, Why do you instantiate objects? GOF: Factories, Builder, Prototype, Singleton Structural Change, Migrate, Add to, Copy, Split, Move objects GOF: Adapter, Bridge, Composite, Decorator, Façade, Flyweight, Proxy Behavioral Passing around, working on, alter, add functionality to objects Command, Chain of Responsibility, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template, Visitor
14
Commonly Used Design Patterns! Observer Pattern – Start nice and easy
15
Commonly used Design Patterns! Singleton Pattern – Very common / Easy to write
16
Commonly Used Design Patterns! Factory Pattern – Delegate “New”ing objects
17
Commonly Used Design Patterns! Command (AKA Action) Pattern – Store, Queue, Execute
18
Commonly Used Design Patterns! Template – Delegate base functionality
19
Commonly Used Design Patterns! State Pattern – Delegate action based on state
20
Commonly Used Design Patterns! Strategy Pattern – Algorithms / Single or Multi Pass
21
Anti Patterns Square Pegs / Round Holes Don’t use a pattern just because Don’t over engineer Don’t make fun of others Don’t overuse a pattern If every class uses the same pattern it’s probably over used. This is an easy trap to fall into.
22
Special Thanks Brainstorm + session guidance Jeffrey Palermo Glenn Block Ward Bell James Avery Paul Glavich Jeff Widmer
23
Recommended Reading (where to learn more) Elements of Reusable Object-Oriented Software Commonly known as “The Gang of Four” Martin Fowler’s PoEAA Patterns of Enterprise Application Architecture O’Reilly: Head First Design Patterns Joshua Kerievsky Refactoring to Patterns DoFactory.com
24
Track Resources Visit the DPR TLC for a chance to win a copy of Visual Studio Team Suite. Daily drawing occurs every day in the TLC at 4:15pm. Stop by for a raffle ticket http://www.microsoft.com/visualstudio http://www.microsoft.com/visualstudio/en- us/products/teamsystem/default.mspx Please visit us in the TLC blue area
25
www.microsoft.com/teched Sessions On-Demand & Community http://microsoft.com/technet Resources for IT Professionals http://microsoft.com/msdn Resources for Developers www.microsoft.com/learning Microsoft Certification and Training Resources www.microsoft.com/learning Microsoft Certification & Training Resources Resources
26
Complete an evaluation on CommNet and enter to win!
27
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.