Tag: Pattern
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
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
Python : How to remove files by matching pattern | wildcards | certain extensions only ?
In this article we will discuss how to delete few files from a directory based on matching pattern or wildcard. Suppose we have a directory that contains some log files and some text files and we want to delete all .txt files from that directory i.e. files that ends with string “.txt”. Let’s discuss how …
Python : How to remove files by matching pattern | wildcards | certain extensions only ?Read More
Check If Any Element in Array Matches Regex Pattern in C++
This tutorial will discuss about a unique way to check if any element in array matches regex pattern in C++. The std::regex_match() function from the <regex> header file, accepts a string as the first argument and a regex pattern as the second argument. It returns true if the given string matches the given regex pattern. …
Check If Any Element in Array Matches Regex Pattern in C++Read More