Design Pattern – Adapter

C# CONCEPTSAccording to Gang of Four, the Adapter Pattern converts the interfaces of a class into interfaces that the client requires.In other words, the adapter design pattern helps incompatible interfaces work collectively.Photo by Brett Sayles from PexelsUse CaseLet's consider an example of two organizations merging; X organization is taking over Y, but while combining code, the … Continue reading Design Pattern – Adapter

Design Pattern – Builder

C# CONCEPTSAccording to Gang of Four, a creational pattern “Builder” allows to separate and reuse a specific method to build something.Photo by Andrea Piacquadio from PexelsUse CaseLets us take an example of a Car, and the user wanted to build two models, i.e., SUV and Sedan.Builder design pattern comes in handy in the above use case, … Continue reading Design Pattern – Builder

Design Pattern – Observer

C# CONCEPTSAccording to Gang of Four, observer pattern defines dependency b/w two or more objects. So when one object state changes, then all its dependents are notified.Photo by Christina Morillo from PexelsIn other words, a change in one object initiates the notification in another object.Use CaseLet’s take an example of an Instagram celebrity influence who has … Continue reading Design Pattern – Observer

Design Pattern – Iterator

C# CONCEPTSAccording to Gang of Four, the iterator pattern provides a process to obtain the aggregator object without knowing its implementation.Use CaseLet us take an example of a collection list of cars and string[] an array of motorcycles, we need to design an aggregator object so that one can iterate over the collection without knowing … Continue reading Design Pattern – Iterator

Design Pattern – Decorator

C# CONCEPTSAccording to Gang of Four, the pattern adds extra responsibilities to a class object dynamically.Photo by Jonas Svidras from PexelsUse CaseLet’s consider the example of buying a car worth ten lakhs; the company provides the following additional featuresSunroofAdvance Music Systemand many moreWith some additional features, the total price of the car increases. Let’s implement the … Continue reading Design Pattern – Decorator

Design Pattern – Singleton

C# CONCEPTSGang of Four - Singleton design pattern ensures that a particular class has only one instance/object and a global access point.Photo by Sebastian Voortman from PexelsPrerequisitesBasic knowledge of OOPS concepts.Any programming language knowledge.The article demonstrates the usage of singleton design patterns using the C# programming language. So, to begin with, C#Learning ObjectivesHow to code using a … Continue reading Design Pattern – Singleton

Design Pattern – Abstract Factory

C# CONCEPTSAccording to Gang of Four, abstract factory patterns can be assumed as the factory for creating factories.Learning ObjectivesWhat is the abstract factory design pattern?How to write code using the abstract factory design pattern?How to create a factory provider?How to create a client application(from the Main method) that uses factory providerPrerequisitesAbstract factory pattern is purely … Continue reading Design Pattern – Abstract Factory

Design Pattern – Factory Method

C# CONCEPTSAccording to the Gang of Four, the factory method allows the subclass to determine which class object should be created.Photo by Life Of Pix from PexelsLearning ObjectivesWhat is the factory method design pattern?How to write code using the factory method?PrerequisitesBasic knowledge of OOPS concepts.Any programming language knowledge.The article demonstrates the factory method using the C# programming … Continue reading Design Pattern – Factory Method

Property Pattern Extended C#

C# CONCEPTSLearn to use pattern matching for complex scenarios.This article focus on extending the property pattern to next level. Refer prerequisites section for previous toll fare example used and following article extends that example further.PrerequisitesPlease go through the below article example, which calculates a toll fare based upon the vehicle type.Recap of requirements already covered:If the … Continue reading Property Pattern Extended C#

Fluent Interface Design Pattern

C# CONCEPTSLearn to apply method chaining & conjunctions design pattern.Photo by Nate Grant on UnsplashWhat is Method Chaining?It’s used to link multiple methods calls into a single compound statement. Method Chaining requires that every method return an interface that supports chaining. It may take some time to get used to because even setters in a Fluent world … Continue reading Fluent Interface Design Pattern