Skip to content

Implementation of various design patterns in Java, Python and C++.

License

Notifications You must be signed in to change notification settings

laxmena/DesignPatterns

Repository files navigation

DesignPatterns

Implementation of various design patterns in C++, Java and Python.

This is an Open Source project created to serve as a Reference material. If you find this repository useful, do star the repository to show your support.


Strategy Pattern

Description: Strategy Pattern in implemented in a primitive VideoStreaming service, that automatically changes Streaming Strategy in run-time based on network speed of the client.


Observer Pattern

Description: A Digital News Agency and Subscriber has been designed to demonstrate the Observer pattern. Whenever there is a new news added to the NewsAgency(The Publisher/Observable), all its subscribers are notified.


Decorator Pattern

Description: Decorator pattern adds additional functionality to the existing classes. This pattern satisfies the Open-Close principle.

Coffee-Hut Example

Example Description: This example implements the Decorator Pattern to simulate a Coffee Shop billing system, where the users can customize the coffee with condiments in infinite possibilities.

Notification Channels Example:

Decorator Pattern is used to simulate a Notification system. The user can opt in for combination of multiple notification channels like SMS, Slack and Facebook along with the default Email notification channel.


Factory Method Pattern

Description:

Database Adapter Example

Example Description: Simple Database Adapter - implements Factory method. Makes use of Two Factories - one for SQL and another for NoSQL that helps create different Databases, and perform queries on them.


Abstract Factory Pattern

Description: Abstract Factory is a creational design pattern that lets us produce families of related objects without specifying their concrete classes. Definition Source.

Furniture Store Example

Example Description: Abstract Factory Pattern is implemented here with an example of a Furniture Store. We consider three different styles of furniture - Victorian, Modern and ArtDeco. Also, There are three furniture products in each style - Table, Chair and Sofa. Which essentially adds upto 9 products, and should be flexible to expand. Abstract Factory is implemented to approach this challenge.


If you have any feedbacks, comments or suggestions regarding this repository, please do let me know!

You can contact me through Email, LinkedIn or Twitter

I write Tech blogs and articles here: Medium and Personal Blog!