SlideShare uma empresa Scribd logo
1 de 39
Power of PatternsORMore Than Programming with Objects Intro to Design Patterns Mike Clement @mdclement mike@softwareontheside.com http://blog.softwareontheside.com Utah Code Camp Fall 2011
Design Patterns Defined Alexander’s Architecture Design Patterns Published in 1977
“Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to the problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.” -Christopher Alexander
A Pattern is a solution to a problem in a context Context – recurring situation Problem – goal and constraints Solution – general design to resolve the problem If it only happened once, it’s not a pattern
Why should I care About Patterns? The question of the day!
Guitar Different implementations, but all recognized as “a guitar”
Kitchen Preparing/Cooking food Store cooking tools Stove Refrigerator Sink Counter space Dishwasher
Power of a Pattern Language A shared vocabulary Powerful Say more with less Stay “in the design” longer Turbo charge the team Gets new hires up to speed
From Architecture to Software 1987 – Kent Beck and Ward Cunningham presented at OOPSLA 1994 – GoF book published
GOF Pattern Template Pattern Name Classification Intent Also Known As Motivation Applicability Structure Participants Collaborations Consequences Implementation Sample Code Known Uses Related Patterns
GoF Pattern Catalog Creational Patterns Abstract Factory	  Creates an instance of several families of classes Builder	  Separates object construction from its representation Factory Method	  Creates an instance of several derived classes Prototype	  A fully initialized instance to be copied or cloned Singleton	  A class of which only a single instance can exist Structural Patterns Adapter	  Match interfaces of different classes Bridge	  Separates an object’s interface from its implementation Composite	  A tree structure of simple and composite objects Decorator	  Add responsibilities to objects dynamically Facade	  A single class that represents an entire subsystem Flyweight	  A fine-grained instance used for efficient sharing Proxy	  An object representing another object Behavioral Patterns Chain of Resp.	  A way of passing a request between a chain of objects Command	  Encapsulate a command request as an object Interpreter	  A way to include language elements in a program Iterator	  Sequentially access the elements of a collection Mediator	  Defines simplified communication between classes Memento	  Capture and restore an object's internal state Observer	  A way of notifying change to a number of classes State	  Alter an object's behavior when its state changes Strategy	  Encapsulates an algorithm inside a class Template Method	  Defer the exact steps of an algorithm to a subclass Visitor	  Defines a new operation to a class without change
GoF Classification
We need some code that… Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically
Observer Pattern Intent: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically Also Known As: Publish-Subscribe
Patterns are not created… They are discovered!
Let’s discover a pattern! Object oriented principles sneak in
Duck Simulator
Adding “fly()”
But RubberDuck now flies…
Override fly? One possible solution But what happens when we have this?
Interfaces?
Encapsulate what varies Important OOP Principle!
Behaviors separated
The New Duck Program to an interface, not an implementation Important OOP Principle!
Delegate the behavior
Implementation specifies behavior
The Strategy Pattern
Patterns are not created… They are discovered!
OO Principles Encapsulate what varies. Favor composition over inheritance. Program to interfaces, not implementations. Strive for loosely coupled designs between objects that interact. Open for extension but closed for modification. Depend on abstractions. Only talk to your friends. Don't call us, we'll call you. A class should have only one reason to change.
Beyond Architectural Application Domain-Specific Business Process Organizational User Interface Design
Anti-Patterns Tells you how to go from a problem to a BAD solution. Why the bad solution is unattractive Why in the long term it’s bad Suggests other patterns for a good solution
Catalog… Big Ball of Mud Gold Plating Interface Bloat God Object Coding by Exception Copy and Paste Golden Hammer Cargo Cult Analysis Paralysis Design by Committee Vendor Lock-in Groupthink Mushroom Management
Share the Vocabulary In design meetings With other developers In architecture documentation In code comments and naming conventions To groups of interested developers
Learning more… I really like this one… some people find it annoying. Puts Design Patterns in the context of OOP. Great reference.  Definitive resource. Put me to sleep the first couple times I tried to read it though.
My Contact Info @mdclement mike@softwareontheside.com http://blog.softwareontheside.com Utah Software Craftsmanship Group https://groups.google.com/forum/#!forum/ut-software-craftsmanship @utahsc

Mais conteúdo relacionado

Mais de Mike Clement

Taming scary production code that nobody wants to touch
Taming scary production code that nobody wants to touchTaming scary production code that nobody wants to touch
Taming scary production code that nobody wants to touchMike Clement
 
Develop your sense of code smell
Develop your sense of code smellDevelop your sense of code smell
Develop your sense of code smellMike Clement
 
Maps over Backlogs: User Story Mapping to Share the Big Picture
Maps over Backlogs: User Story Mapping to Share the Big PictureMaps over Backlogs: User Story Mapping to Share the Big Picture
Maps over Backlogs: User Story Mapping to Share the Big PictureMike Clement
 
Escaping the Pitfalls of Software Product Development
Escaping the Pitfalls of Software Product DevelopmentEscaping the Pitfalls of Software Product Development
Escaping the Pitfalls of Software Product DevelopmentMike Clement
 
Transformation Priority Premise: TDD Test Order Matters
Transformation Priority Premise: TDD Test Order MattersTransformation Priority Premise: TDD Test Order Matters
Transformation Priority Premise: TDD Test Order MattersMike Clement
 
Code Katas Spring 2012
Code Katas Spring 2012Code Katas Spring 2012
Code Katas Spring 2012Mike Clement
 
FizzBuzz Guided Kata
FizzBuzz Guided KataFizzBuzz Guided Kata
FizzBuzz Guided KataMike Clement
 
Linq (from the inside)
Linq (from the inside)Linq (from the inside)
Linq (from the inside)Mike Clement
 
Bowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedBowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedMike Clement
 
Code Katas: Practicing Your Craft
Code Katas: Practicing Your CraftCode Katas: Practicing Your Craft
Code Katas: Practicing Your CraftMike Clement
 
Software Craftsmanship
Software CraftsmanshipSoftware Craftsmanship
Software CraftsmanshipMike Clement
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingMike Clement
 

Mais de Mike Clement (13)

Taming scary production code that nobody wants to touch
Taming scary production code that nobody wants to touchTaming scary production code that nobody wants to touch
Taming scary production code that nobody wants to touch
 
Develop your sense of code smell
Develop your sense of code smellDevelop your sense of code smell
Develop your sense of code smell
 
Maps over Backlogs: User Story Mapping to Share the Big Picture
Maps over Backlogs: User Story Mapping to Share the Big PictureMaps over Backlogs: User Story Mapping to Share the Big Picture
Maps over Backlogs: User Story Mapping to Share the Big Picture
 
Escaping the Pitfalls of Software Product Development
Escaping the Pitfalls of Software Product DevelopmentEscaping the Pitfalls of Software Product Development
Escaping the Pitfalls of Software Product Development
 
Thinking in F#
Thinking in F#Thinking in F#
Thinking in F#
 
Transformation Priority Premise: TDD Test Order Matters
Transformation Priority Premise: TDD Test Order MattersTransformation Priority Premise: TDD Test Order Matters
Transformation Priority Premise: TDD Test Order Matters
 
Code Katas Spring 2012
Code Katas Spring 2012Code Katas Spring 2012
Code Katas Spring 2012
 
FizzBuzz Guided Kata
FizzBuzz Guided KataFizzBuzz Guided Kata
FizzBuzz Guided Kata
 
Linq (from the inside)
Linq (from the inside)Linq (from the inside)
Linq (from the inside)
 
Bowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedBowling Game Kata in C# Adapted
Bowling Game Kata in C# Adapted
 
Code Katas: Practicing Your Craft
Code Katas: Practicing Your CraftCode Katas: Practicing Your Craft
Code Katas: Practicing Your Craft
 
Software Craftsmanship
Software CraftsmanshipSoftware Craftsmanship
Software Craftsmanship
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit Testing
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Power of Patterns OR More Than Programming with Objects

  • 1. Power of PatternsORMore Than Programming with Objects Intro to Design Patterns Mike Clement @mdclement mike@softwareontheside.com http://blog.softwareontheside.com Utah Code Camp Fall 2011
  • 2. Design Patterns Defined Alexander’s Architecture Design Patterns Published in 1977
  • 3. “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to the problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.” -Christopher Alexander
  • 4. A Pattern is a solution to a problem in a context Context – recurring situation Problem – goal and constraints Solution – general design to resolve the problem If it only happened once, it’s not a pattern
  • 5. Why should I care About Patterns? The question of the day!
  • 6. Guitar Different implementations, but all recognized as “a guitar”
  • 7. Kitchen Preparing/Cooking food Store cooking tools Stove Refrigerator Sink Counter space Dishwasher
  • 8. Power of a Pattern Language A shared vocabulary Powerful Say more with less Stay “in the design” longer Turbo charge the team Gets new hires up to speed
  • 9. From Architecture to Software 1987 – Kent Beck and Ward Cunningham presented at OOPSLA 1994 – GoF book published
  • 10. GOF Pattern Template Pattern Name Classification Intent Also Known As Motivation Applicability Structure Participants Collaborations Consequences Implementation Sample Code Known Uses Related Patterns
  • 11. GoF Pattern Catalog Creational Patterns Abstract Factory Creates an instance of several families of classes Builder Separates object construction from its representation Factory Method Creates an instance of several derived classes Prototype A fully initialized instance to be copied or cloned Singleton A class of which only a single instance can exist Structural Patterns Adapter Match interfaces of different classes Bridge Separates an object’s interface from its implementation Composite A tree structure of simple and composite objects Decorator Add responsibilities to objects dynamically Facade A single class that represents an entire subsystem Flyweight A fine-grained instance used for efficient sharing Proxy An object representing another object Behavioral Patterns Chain of Resp. A way of passing a request between a chain of objects Command Encapsulate a command request as an object Interpreter A way to include language elements in a program Iterator Sequentially access the elements of a collection Mediator Defines simplified communication between classes Memento Capture and restore an object's internal state Observer A way of notifying change to a number of classes State Alter an object's behavior when its state changes Strategy Encapsulates an algorithm inside a class Template Method Defer the exact steps of an algorithm to a subclass Visitor Defines a new operation to a class without change
  • 13. We need some code that… Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically
  • 14. Observer Pattern Intent: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically Also Known As: Publish-Subscribe
  • 15.
  • 16.
  • 17. Patterns are not created… They are discovered!
  • 18. Let’s discover a pattern! Object oriented principles sneak in
  • 21. But RubberDuck now flies…
  • 22. Override fly? One possible solution But what happens when we have this?
  • 24. Encapsulate what varies Important OOP Principle!
  • 26. The New Duck Program to an interface, not an implementation Important OOP Principle!
  • 30. Patterns are not created… They are discovered!
  • 31. OO Principles Encapsulate what varies. Favor composition over inheritance. Program to interfaces, not implementations. Strive for loosely coupled designs between objects that interact. Open for extension but closed for modification. Depend on abstractions. Only talk to your friends. Don't call us, we'll call you. A class should have only one reason to change.
  • 32. Beyond Architectural Application Domain-Specific Business Process Organizational User Interface Design
  • 33. Anti-Patterns Tells you how to go from a problem to a BAD solution. Why the bad solution is unattractive Why in the long term it’s bad Suggests other patterns for a good solution
  • 34. Catalog… Big Ball of Mud Gold Plating Interface Bloat God Object Coding by Exception Copy and Paste Golden Hammer Cargo Cult Analysis Paralysis Design by Committee Vendor Lock-in Groupthink Mushroom Management
  • 35.
  • 36.
  • 37. Share the Vocabulary In design meetings With other developers In architecture documentation In code comments and naming conventions To groups of interested developers
  • 38. Learning more… I really like this one… some people find it annoying. Puts Design Patterns in the context of OOP. Great reference. Definitive resource. Put me to sleep the first couple times I tried to read it though.
  • 39. My Contact Info @mdclement mike@softwareontheside.com http://blog.softwareontheside.com Utah Software Craftsmanship Group https://groups.google.com/forum/#!forum/ut-software-craftsmanship @utahsc

Notas do Editor

  1. "Each solution is stated in such a way that it gives the essential field of relationships needed to solve the problem, but in a very general and abstract way - so that you can solve the problem for yourself, in your own way, by adapting it to your preferences, and the local conditions at the place where you are making it.“Includes patterns for “problems” such asHomes“Couple’s Realm”“Farmhouse Kitchen”“Bulk Storage”Offices Space“Communal Eating”“A Place to Wait”Communities“Ring Roads”“Web of Shopping”“Sacred Sites”“Night Life”“Household Mix”
  2. When you say “kitchen” you get all those other descriptors for free. Instead of detailing everything, you can focus on exceptions to the pattern.
  3. From Head First Design Patterns p28A shared vocabularyPowerful – communicating qualities, characteristics and constraintsSay more with lessStay “in the design” longer – avoids getting prematurely into implementation detailsTurbo charge the team – team moves more quickly with less room for misunderstandingGets new hires up to speed – easily allows new hires (college or industry)to get up to speed with defined patterns
  4. 1987 is when Kent Beck and Ward Cunningham first introduced the concept to software. Took another few years before the GoF book was published and then from there it’s exploded.
  5. Sample CodeUse of sample code is a little bit controversial because of the previous statements. GoF writers decided that the usefulness of having something concrete outweighed the need for “purity” in their pattern catalog. Even class diagrams can be too prescriptive which we’ll see later.ConsequencesBoth positive and negative. Sometimes a pattern’s effects are not entirely positive.
  6. Creational – where objects come from, instantiationBehavioral – interaction and responsibilityStructural – composing classes/object into larger structures
  7. Instead of this, I could simply say… let’s use the…
  8. Often as part of a pattern definition we’ll have a class diagram to help describe how the pattern *could* be implemented. Remember Alexander said a pattern means that we can “use this solution a million times over, without ever doing it the same way twice”
  9. Raises the question, Is a class diagram too much for pattern definition?.NET alternatives to this class structure?
  10. Those that build pattern catalogs aren’t “creators” but are discoverers. They “see” the pattern and catalog it.
  11. Two of the OO Basics that usually go hand in hand are Inheritance and Polymorphism. If you don’t remember, the other two are Abstraction and Encapsulation. (these can change depending on who is defining… but regardless…)What is a “classic” use of inheritance and polymorphism? What’s the first think you coded up in intro to programming that used inheritance?Shapes, animalsWe’re going to use ducks…
  12. “Classic” use of inheritance… different types of somethingCurrently we just have to display the ducks so this is okay. But…
  13. What if we add “fly()”? Here we add it to the base class and all the subclasses fly fine but…
  14. What seemed like a great use of inheritance for reuse hasn’t worked out so well for maintenanceRemember, that writing code “fast” now isn’t usually the main goal. We need to write code that can be easily maintained.By maintained I mean any future modification, including debugging and modifications BEFORE release of the product.
  15. Using the Java “able” interface convention.No inappropriate behaviors but now behavior code is duplicated.We traded one maintenance problem for another!
  16. Instead of having the behavior embedded in the classes, we’re going to encapsulate them elsewhere. This way they are centralized (not duplicated) and
  17. Those that build pattern catalogs aren’t “creators” but are discoverers. They “see” the pattern and catalog it.
  18. Application of OO Principles will usually drive us to a well known good pattern or variation of a pattern.We took Encapsulate what varies combined with Program to interfaces not implementations and we ended up with the Strategy Pattern.
  19. Architectural – already talked about itApplication – System level, multi-tierDomain – concurrent or real-time systems, maybe even domains like accountingBusiness Processes – interaction between businesses, within businesses, communicate decisions You expect order confirmation emailOrganizational – human organizations (how teams are structured, interact with other teams)AJAX or UI in generalWidgets – what do you expect them to do?Visual effects – highlighting changes
  20. Ineffective and/or counterproductive practices.Why Anti-patterns?By formally describing repeated mistakes, one can recognize the forces that lead to their repetition and learn how others have refactored themselves out of these broken patterns.
  21. Big ball of mud: A system with no recognizable structureGold plating: Continuing to work on a task or project well past the point at which extra effort is adding valueInterface bloat: Making an interface so powerful that it is extremely difficult to implementGod object: Concentrating too many functions in a single part of the design (class)Coding by exception: Adding new code to handle each special case as it is recognizedCopy and paste programming: Copying (and modifying) existing code rather than creating generic solutionsGolden hammer: Assuming that a favorite solution is universally applicableCargo cult programming: Using patterns and methods without understanding whyAnalysis paralysis: Devoting disproportionate effort to the analysis phase of a projectDesign by committee: The result of having many contributors to a design, but no unifying visionVendor lock-in: Making a system excessively dependent on an externally supplied componentGroupthink: During groupthink, members of the group avoid promoting viewpoints outside the comfort zone of consensus thinkingMushroom management: Keeping employees uninformed and misinformed (kept in the dark and fed manure), let to stew, and finally canned.
  22. Use it or it’s not usefulCan use the brownbag sessions in the future to present different design patterns/pattern languages or catalogs