Close
IteratorPattern
IteratorPattern

Iterator Design Pattern

Introduction The iterator design pattern states that, if a  collection of items stored in a certain data structure. And if this collection can possibly be traversed in different ways as per client use cases. Then separate each type of traversal logic to its individual class, each of this class should implement a common Iterator interface.…

Restaurant deception to saw command design pattern

Command design pattern

Introduction Command design pattern states that the client request can be encapsulated in an object called command, which is further delivered to the appropriate receiver which knows how to handle this client request. Why is this pattern needed? In use cases when multiple clients might need the same functionality to be shared then command design…

Editor feature with memento design pattern

Memento Design Pattern

Introduction Memento design pattern states that object state can be externalized and can be restored as needed. This pattern mentions three components which are object of interest i.e. Originator, Memento which wraps the originator and  client that takes care of the memento object called as Caretaker. Why do you need this pattern? The pattern can…

Observer Design Pattern deception via a binnacle.

Observer Design Pattern

Introduction The observer design pattern states that, objects of interest should be able to update the state change to the interested clients. Where in objects of interest and interested clients are called Publishers and Subscribers respectively. Why is this pattern needed? Lets say there are two types of magazine readers paperback and digital. Each of…

Strategy Pattern for SuperHero powers

Strategy design pattern

Introduction Strategy design pattern states that if an algorithm has different forms. Then each of these forms must be implemented in their own class. The client using these different algorithmic forms is allowed to interchangeable use each of this as required. Why do we need this strategy pattern? Lets assume that we have a module…

State Design Pattern

State Design Pattern

Introduction State design pattern is a behavioral design pattern, meaning which changes its behaviour based on its object’s internal state. To achieve this each object incorporated the state specific behaviour. Moreover adding new states does not affect the existing states. Lets take a closer look and discuss this in more details. Why do we need…

Single Responsibility Principle

Software Design S.O.L.I.D principles guide book – Single Responsibility Principle

Introduction Continuing our discussion on S.O.L.I.D principle, checkout Open Closed Principle (OCP), Liskov Substitution Principle (LSP), Dependency Inversion Principle (DIP), Interface Segregation Principle (ISP) if not so far. In this blog lets cover yet another principle i.e. Single Responsibility Principle short hand (SRP). Let’s dive in. Single Responsibility Principle SRP states that “Any class should…

Interface Segregation Principle

Software Design S.O.L.I.D principles guide book – Interface Segregation Principle

Introduction Continuing our discussion on S.O.L.I.D principle, checkout Open Closed Principle (OCP), Liskov Substitution Principle (LSP), Dependency Inversion Principle (DIP) if not so far. In this blog lets cover yet another principle i.e. Interface Segregation Principle short hand ISP. Lets dive in Interface Segregation Principle If an interface is serving multiple clients then better to…