Tuesday, June 3, 2014

Design Patterns in Programming


In software development there is one constant:
CHANGE

All applications will grow and change over time, or die. As a developer it is therefore desirable for an application to be easy to understand, maintainable and flexible. You may think that knowing the object oriented basics will automatically result in such applications, but:
  • Knowing OO basics does not make you a good OO designer.
  • Good OO designs are reusable, extensible and maintainable.
  • Patterns show you how to build systems with good OO design qualities.
  • Patterns are proven OO experience.
  • Patterns don't give you code, they give you general solutions to design problems. You apply them to your secific application.
  • Patterns are not invented but discovered.
  • Most patterns and principles adress issues of change in software
  • Most patterns allow some part of a system to vary independently of all other parts.
Design patterns are not just good object-oriented design. Knowing OO basics does not mean you will automatically be good at building flexible, reusable, and maintainable systems. They are a collection of, sometimes non-obvious, ways of constructing OO systems (let you skip the hard work of finding those ways yourself). If you can not find a pattern that matches your problem, think about the Design principles that design patterns use.

Advantage of design patterns:
  1. shared vocabulary with other developers (less time explaining).
  2. do not just communicate a pattern name, but also a whole set of qualities, characteristics and constraints that the pattern represents. e.g.: Strategy Pattern encapsulated behavior into its own set of classes that can be easily expanded and changed at run time
  3. Allows to keep discussions at the design level (not too much details of implementation) better structure of applications (easy to understand, maintainable, flexible)
In the next few posts I want to cover the following topics:

OO Basics:
    Abstraction
    Encapsulation
    Polymorphism
    Inheritance
OO Principles
OO Patterns
    Strategy
    Observer
    Decorator
    Factory Method
    Abstract Factory
    Singleton
    Command 

(I will be editing this page, adding other patterns)

No comments:

Post a Comment