Black Magic of Design Patterns

18/08/2019

Why Patterns?

Design Patterns we have heard this name many times, we also come across many variants of it for various use cases and applications, however, why think of patterns is something that is less understood or asked about. We feel why to ask this simple question which is, in fact, the basis of this subject.  Patterns didn't start with the GoF; they started with Christopher Alexander, a Professor of Architecture at Berkeley - that's right, Alexander is an architect, not a computer scientist [Head first Design Patterns]. However, I feel patterns are not limited to Alexanders or the GOF's book, they exist naturally in nature and the software we design. In the natural world, we come across many patterns, complex or simple, however, it is well understood that all complex patterns are formed with the interconnection of the simple ones and most of these patterns in the natural world extend boundlessly. e.g. a tree has roots, branches, leaves, and flowers, each has its own life cycle except the roots, this shows similarities to the Composite design pattern where you compose from a natural set of expressions or methods at the root a then streamline as you go along. Hence it's necessary to understand and exercise these patterns to build complex systems which can be reliable and sustainable.

The principles

SOLID: is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible and maintainable. The principles are a subset of many principles promoted by American software engineer and instructor Robert C. Martin [wikipedia].  The principles are described below.

Pillars of OOPS

OOPS pillars
OOPS pillars

Classification of Patterns

https://www.vincehuston.org/dp/
https://www.vincehuston.org/dp/

Some Useful patterns - Code in Git hub

  1. Thread Safe Singleton 
  2. Observer
  3. Mediator
  4. Factory 
  5. Decorator
  6. Strategy
  7. Bridge
  8. Adapter
  9. Composite
  10. Command 

How to use them - use cases

Anti-patterns and code smells

How to approach? - keep it simple






© 2019 Mary's beauty & lifestyle blog. All rights reserved.
Powered by Webnode Cookies
Create your website for free! This website was made with Webnode. Create your own for free today! Get started