Click here to Skip to main content
15,886,673 members
Articles / Patterns

Design Patterns - I (Introduction)

Rate me:
Please Sign up or sign in to vote.
4.61/5 (18 votes)
6 Dec 2013CPOL3 min read 33.7K   48   5
A Seriers to understand Design Patterns Completely

Authoring software requires a set of rules and methodologies to take your idea to center point without any rework for future enhancements.  In Software Engineering, we have a set of principles stated by Robert Martin called SOLID principle.   SOLID word has principles as Single Responsibility, Open Close, Liskov’s Substitution, Interface Segregation and Dependency Inversion. Let me explain you about SOLID as one word 

SOLID

  • Single Responsibility Principle – There should be a one strong reason to change the class.

  • Open/Close Principle – Entities should open only for adding new functionality and Close for any updates after testing phase.

  • Liskov’s Substitution Principle – Functions accessing base class must be able to access derived class

  • Interface Segregation Principle – Clients should use Interface members completely.

  • Dependency Inversion Principle – High level modules and Details should depend on abstractions only.

Other Main Principles of Software design Engineering is

  • Dry (Don’t Repeat Yourself): Code should occur exactly once in the system.

  • KISS (Keep it Simple, Stupid!): Unnecessary complex code should avoided.

  • YAGNI (You ain’t  gonna need it): Implement the things when you need them

These principles results to maintain your software code as manageable, Scalable and reusable code and results in faster development.

In point of code reusability Design Patterns are introduced.  Design patterns are introduced by Christopher Alexander in 1977, Kent Beck and Ward Cunningham in 1987.  Design patterns are considered as reusable solutions for commonly occurring problems in software designs.  Advantages of design patterns are, they provide solutions for commonly occurring problems in software designs, they can implement in any language, provide standard terminology and specific to particular scenario.  Design Patterns are categorized into 5 categories. 

  1. Creational Patterns

  2. Structural Patterns

  3. Behavioral Patterns

  4. Model – View – Controller Patterns

  5. Concurrency Patterns

Creational Patterns:

Creational Patterns are patterns deals with object Creations.  Creational Patterns are applicable when:

  1. A system should be independent of how its objects and products are creating.

  2. Two or more objects designed to use each other.

  3. Instance, can be extended without modification.

  4. Sub class of a class wants to access class object.

  5. Reveling interfaces of a product.

  6. Constructing different independent Complex objects.

  7. Single instance can be access all the time.

Structure of these creational patterns contains creation followed by its concrete creator. Creation Patterns group contains 7 Design patterns.

  1. Abstract Factory

  2. Factory Method

  3. Builder

  4. Lazy Initialization

  5. Object Pool

  6. Prototype

  7. Singleton

Structural Patterns:

Structural Design Patterns are used to define entity relationships in simple ways. Structural patterns use inheritance to compose interfaces or implementations.  Structural patterns are useful to develop independent class libraries to work together.

Structural Patterns has 11 Patterns with it.

  1. Adapter

  2. Aggregate

  3. Bridge

  4. Composite

  5. Decorator

  6. Extensibility

  7. Facade

  8. Flyweight

  9. Pipes and filters

  10. Private Class Data

  11. Proxy

Behavioral Patterns:

Behavioral Design Patterns identifies common communication between objects and realize these patterns.  These patterns increase the flexibility of communication between the objects.

Behavioral Patterns has 19 patterns.

  1. Chain of responsibility

  2. Command

  3. Externalize the Stack

  4. Hierarchical visitor

  5. Interpreter

  6. Iterator

  7. Mediator

  8. Memento

  9. Null Object

  10. Observer

  11. Weak reference

  12. Protocol stack

  13. Scheduled-task

  14. Single-serving visitor

  15. Specification

  16. State

  17. Strategy

  18. Template method

  19. Visitor

Model-View-Controller:

Model View Controller design pattern has its own identity which has 3 inter connected parts, Model, View and Controller.  We use this mainly for User Interfaces.

Concurrency Patterns:

These Patterns mainly deals with Multi thread Programming.  They were associated with Pattern Oriented Software Architecture.  Concurrency Patterns have 11 Patterns.

  1. Active Object

  2. Balking pattern

  3. Double checked locking pattern

  4. Guarded suspension

  5. Leaders/followers pattern

  6. Monitor Object

  7. Reactor pattern

  8. Read write lock pattern

  9. Scheduler pattern

  10. Thread pool pattern 

  11. Thread-Specific Storage

……To be Continue

 

References:  

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
A Developer

Comments and Discussions

 
SuggestionNIce Article , see some pattern in cloud design pattern Pin
Asutosha19-Feb-15 20:49
professionalAsutosha19-Feb-15 20:49 
GeneralRe: NIce Article , see some pattern in cloud design pattern Pin
coded00722-Feb-15 18:52
professionalcoded00722-Feb-15 18:52 
QuestionBetter English needed Pin
AllUserNamesTaken29-May-14 4:23
AllUserNamesTaken29-May-14 4:23 
GeneralGood Article Pin
venky28410-Dec-13 21:51
venky28410-Dec-13 21:51 
GeneralRe: Good Article Pin
coded00711-Dec-13 1:27
professionalcoded00711-Dec-13 1:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.