GofPatterns Gofpatterns  

Design Patterns  «Prev  Next»
Lesson 1
Design Patterns
Welcome to GOF Patterns which is the acroynm for Gang of Four Patterns.
The first module in this course presents you with the groundwork in preparation for the material that you will be reading.
Course goals
In this course you will learn what the GOF (Gang of Four) patterns are and how they help solve common problems encountered in object-oriented design.
After completing this course, you'll be able to:
  1. Use creational patterns to create objects when constructors will not serve your purpose.
  2. Behavioral patterns characterize the ways in which classes or objects interact and distribute responsibility.
    You will learn how to use behavioral patterns to reduce complicated flow control.
  3. Furthermore, you will use behavioral patterns to encapsulate algorithms and dynamically select them at run time.
  4. Structural patterns deal with the composition of classes or objects.
  5. The 2 most common techniques for reusing functionality in object-oriented systems are
    1. Class Inheritance and
    2. Object Composition
  6. You will learn how to use the Gang of Four Pattners (Design Patterns) to replace inheritance with composition.
  1. composition: Creating objects with other objects as members. Composition should be used when a has-relationship applies
  2. inheritance: The concept of classes automatically containing the variables and methods defined in their supertypes.
Design Patterns - Object-Oriented SoftwareDesign Patterns - Object-Oriented Software

The pattern name is a handle we can use to describe a design problem, its solutions, and consequences. Naming a pattern immediately increases our design vocabulary. It lets us design at a higher level of abstraction. Having a vocabulary for patterns lets us talk about these patterns with our co-workers and to ourselves. It makes it easier to think about designs and to communicate them and their trade-offs to others.

The problem describes when to apply the pattern and explains the problem and its context. It might describe specific design problems such as how to represent algorithms as objects. It might describe class or object structures that are symptomatic of an inflexible design. Sometimes the problem will include a list of conditions that must be met before it makes sense to apply the pattern.
The solution describes the elements that make up the design, their relationships, responsibilities, and collaborations. The solution doesn't describe a particular concrete design or implementation, because a pattern is like a template that can be applied in many different situations. Instead, the pattern provides an abstract description of a design problem and how a general arrangement of elements solves the design problem.