Category: Design Patterns
Designing a Configurable Logging framework using Observer Design Pattern
Almost in all applications we need logging functionality, but requirements varies from project to project. Here we have designing a Configurable Logging framework. First of all, lets have a look at full requirements. Functional Requirements: Advertisements It should provide, A configurable option for other application modules to save logs at more than one platform like, …
Designing a Configurable Logging framework using Observer Design PatternRead More
Binary Tree Traversal with Strategy design pattern and open-closed principle
Many time we need to perform certain tasks on Binary trees. These tasks can be, Counting nodes that satisfy some criteria. Displaying all nodes in particular pattern like, printing expression from expression tree. Creating mirror image of tree. etc. [showads ad=inside_post] To perform these tasks we follow a pattern i.e. traverse the tree and perform …
Binary Tree Traversal with Strategy design pattern and open-closed principleRead More
Task Grouping Using Composite Design Pattern
Many times we need to perform certain tasks and also group them. Â [showads ad=inside_post] Advertisements These tasks can be, Executing commands on console. Performing some SVN operation. Performing any thing specific to our project. Etc. Common things in all these tasks can be, Frequently Asked: Task Grouping Using Composite Design Pattern Every task need …
Learn State Design Pattern by Designing a Simple Music System
Many times we need to develop systems / objects that provides services to outside world. But the response of each service is not always same, it depends upon its current internal state. When its internal state changes at run-time then its behaviour changes and same services acts differently. Advertisements For example, Suppose our system is …
Learn State Design Pattern by Designing a Simple Music SystemRead More
Design Sorting algorithm using Strategy Design Pattern
What is a Strategy? Strategy is a plan of action designed to achieve a long-term or overall aim. Advertisements Behaviour of a class / Algorithm depends upon the strategy they use to covert Input to Output. Frequently Asked: Design Sorting algorithm using Strategy Design Pattern If Strategy is tightly bonded with the Algorithm/Class then variation …
Design Sorting algorithm using Strategy Design PatternRead More
Designing a Multiton: Singleton that returns 5 objects in cycle
Let’s Design a Multiton class i.e. a modified Singleton to return 5 objects in cycle. Logic to Create Multiton Advertisements Instead of keeping a static pointer as member variable keep a vector of pointers as member variable. Now also keep track of how many times getInstance() function is called. To do that use static member …
Designing a Multiton: Singleton that returns 5 objects in cycleRead More
Need of Factory Method Design Pattern in Frameworks Explained
In a framework we deal mainly with abstract classes. Application that is going to use our framework provides the derived classes these abstract classes. Let’s understand by an example of Thread pooling Framework, A thread pooling framework provides the facility to execute Tasks in pooled environment by worker threads. It’s doesn’t know what actually the …
Need of Factory Method Design Pattern in Frameworks ExplainedRead More
Designing Event Handling Framework using Command Design Pattern
In this article we will learn Command Design Pattern by Designing an Event Handling Framework. Intent of Command Design Pattern Encapsulate a request as an object, thereby letting you parametrize clients with different requests, queue or log requests, and support undo able operations.[GoF] Advertisements What a heavy Intent 🙂 Lets learn step by step, Frequently …
Designing Event Handling Framework using Command Design PatternRead More
Designing a Board Game (Mastermind) in C++ using MVC, State and Observer Design Patterns
Let’s Design a Console Based Board Game in C++. With this Design you can learn MVC, Observer and State Design Pattern. Moreover, with the same design you can also implement any other Game Like Battleship etc. Advertisements In this we will build Console Based Version of MasterMind Game. Complete Code for this is available at, Frequently …
Designing a Board Game (Mastermind) in C++ using MVC, State and Observer Design PatternsRead More