Saturday, March 5, 2016

Introduction to Software Design Patterns

This is a presentation I did for the company I work Digital Origin. Its an introduction about architecting software solutions using Design Patterns.  Hope you like it.

What is a Design Pattern

"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice"

- Cristopher Alexander -

"Is a general resuable solution to common ocurring problems. It is a description of template for how to solve a problem in different situations"

- Wikipedia -

Prerequisites & Basic Principles

These are the basic principles one should be concerned before applying patterns.
  • Use Object Oriented language
  • Use of Abstraction
  • Use of Encapsulation
  • Use High Cohesion
  • Use Loose Coupling
  • Use Open - Closed priniple
  • Use Separation Of Concerns
  • Use Dependency Inversion
  • Separate volatile from Stable components
  • Use Interfaces simple, clear and course grained
  • Use Composite reuse instead of inheritance

Most Famous Patterns

  • Layers Pattern
  • Tiers Pattern
  • Model-View-Controller Pattern
  • P.A.C. Architectural Pattern

The Layers Pattern

The Layers pattern structures applications so they can be decomposed into groups of subtasks, each group represents a particular level of abstraction.


The Tiers Pattern

Tiers describe how a distribute application is decomposed into modules to reduce the coupling and imprive the system flexibility. This permits each tier to be modified or enhanced without affecting other tiers. Example for the JAVA world.


The MVC Pattern

The MVC Pattern separates concerns in data presentation, processing and storage. This pattern is useful for emphasizing separation of concerns.


PAC Architectural Pattern

The PAC pattern is a further refinement of the Model View Controller pattern. For complex UIs, it creates a hierarchy of interacting, cooperating agents. Each agen is its own "mini" MVC component. It differs from MVC in that within each agent, the presentation and abstraction are completely separated. This pattern enforces decoupling and separation of concerns.

Pattern Catalog

Here is a list where you can find more design patterns.
  • Hardware Configuration Patterns
  • Software Design Patterns
    • GOF Patterns (Gang Of Four Patterns)
    • Java EE Patterns
  • Architecture Patterns
    • Buschmann, et al. Patterns
    • Enterprise Architecture Integration Patterns
    • Enterprise Application Architecture Patterns
  • Antipatterns: to avoid common design traps
    • Analysis Paralysis
    • Cash Cow
    • Silos
    • God Object

GOF Catalog Of Design Patterns

24 Design Patterns that will help you solve the majority of your problems.
  • Abstract Factory
  • Adapter
  • Bridge
  • Builder
  • Chain Of Responsability
  • Command
  • Composite
  • Decorator
  • Facade
  • Factory Method
  • Flyweight
  • Interpreter
  • Iterator
  • Mediator
  • Memento
  • Observer
  • Prototype
  • Proxy
  • Singleton
  • State
  • Strategy
  • Template
  • Visitor
  • Method

Pattern Classification

The patterns can be classified according to the scope and purpose.


JAVA Patterns

The JAVA language defines another set of design patterns.
  • DAO (Data Access Object)
  • Service Locator
  • Facade
  • Transfer Object
  • Application Service
  • Business Delegate
  • Value List Handler
  • Filter
  • Front Controller
  • Application Controller
  • Context Object
  • View Helper

Using Patterns Across a Network

When working in a network, the Command Pattern is an example of design pattern to send messages from the client to the server. 


Pattern Integration

Several patterns can be combined to architect your solution as show in the picture.


Bibliography


  • Oracle JEE Student Guide for JEE Architects
  • Design Patterns: Elements Of Reusable Object-Oriented Software
    • Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides

No comments:

Post a Comment