Skip to content

jayavardhanravi/DesignPatterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns using C++

Build status Language License

Collection of various design patterns with example implementation in C++. Creational, Structural and Behavioral design patterns have been implemented. This also includes some of the commonly used Idiom in C++ programming. This is just to demonstrate the usage of the design patterns.

Note: Code is NOT optimized but is used as a part of knowledge sharing.

Creational Design Patterns

Pattern Name Description
Factory Method General object construction is replaced with a specific method
Abstract Factory Group of related class without specifying concrete implementation
Builder Stepwise construction of Complex objects
Prototype Object constructed from a prototype
Singleton Build Class with single instance

Structural Design Patterns

Pattern Name Description
Adapter Link Objects with incompatable interfaces/classes
Bridge Decouples Abstraction and implementation
Composition Build Object into tree like structures
Decorator Adding additional Features to existing objects dynamically
Facade For providing simple interface for complex libraries
Flyweight Sharing the common data between multiple objects
Proxy Controlled access to original object

Behavioral Design Patterns

Pattern Name Description
Chain of Responsibility Handle Request/Data by multiple configurable Handlers
PIMPL Pointer to Implementation
Command Convert Requests as Objects for Handling
Iterator Traverse elements in collections without exposing
Mediator Collabration between objects via a mediator
Memento Saving and Restoring the state of an Object
Observer Notify Events between objects having one to many relationship
State Alter the Objects behaviour when internal parameters change
Strategy Run-time changing of objects inturn changing behaviour
Template Provides Skeleton in superclass allowing some of the steps to be overriden by subclasses
Visitor Add new operations without changing the existing code

How to build the project

Clone the Repository

git clone https://github.com/jayavardhanravi/DesignPatterns.git

Open Solution file in Visual studio

In this project I used Visual Studio 2017. Choose and build the specific design pattern either in Debug or Release

References

Books
Book Title Design Patterns Elements Of Reusable Object-Oriented Software
Book Publisher Addison-Wesley
Publication Year 2016

License

License

BSD 2-Clause License

Copyright (c) 2020, Jayavardhan Ravi All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.