GofPatterns Gofpatterns  

Design Patterns  «Prev  Next»
Lesson 5Why use design patterns?
ObjectiveLearn how design patterns assist programmers.
Question: Why would you use design patterns?
Answer: The answer is so simple it is almost a tautology: Design patterns are used because they make your job easier.
Design patterns let you write better code more quickly.
However, patterns are not a panacea. Of the five phases of software development, design patterns do almost nothing in the analysis, testing, or documentation phases. Design patterns, as the name implies, have their biggest impact in the design phase of a project.

To be more precise:
  1. Design patterns help you analyze the more abstract areas of a program by providing concrete, well-tested solutions.
  2. Design patterns help you write code faster by providing a clearer picture of how you're implementing the design.
  3. Design patterns encourage code reuse and accommodate change by supplying well-tested mechanisms for delegation and composition, and other non-inheritance based reuse techniques.
  4. Design patterns encourage more legible and maintainable code by following well-understood paths.
  5. Design patterns increasingly provide a common language and jargon for programmers.

  1. Delegation: This pattern is one where a given object provides an interface to a set of operations. However, the actual work for those operations is performed by one or more other objects.
  2. composition: Creating objects with other objects as members. Composition should be used when a has-a relationship applies.
Domain-Driven DesignDomain-Driven Design
Design Patterns Purpose - Quiz
The following quiz contains questions with respect to the purpose of design patterns.
Design Patterns Purpose - Quiz