According to Gang of Four, it defines a chain of responsibilities to process a request. In other words, pass the request from one object to another until an object accepts its responsibility.

Photo by Miguel Á. Padriñán from Pexels

Use Case

Let’s consider an example of a claims system in any corporate company. Here is the list of the price range that can be approved and by whom.

100–1000 Rs => Junior/Senior Engineers => Approved by Manager1001–10000 Rs => Managers => Approved by Senior Manager

If the amount is outside…


According to Gang of Four, a creational pattern “Builder” allows to separate and reuse a specific method to build something.

Photo by Andrea Piacquadio from Pexels

Use Case

Lets 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, and let's see a step-by-step demonstration.

And the Car class has the following properties.

public class Car{
public string…


How to run SonarQube locally for .Net solutions

The article describes how to analyze C# code quality using the SonarQube command line.

Photo by Jefferson Santos on Unsplash


  1. Download the SonarQube free Community Edition
  2. SonarQube scanners require version 8/11 of the JVM, and the SonarQube requires version 11
  3. Install PostgreSQL for demonstration, but it also supports MSSQL and Oracle databases.
  4. For the .Net Core…


According to Gang of Four, the Mediator pattern encapsulates the object interaction with each other.

The mediator design pattern helps us design loosely coupled applications by encapsulating object interactions.

Use Case

Let’s consider an example of a chatroom where participants register, how to communicate efficiently.

Need to implement following chatroom conversation using the Mediator Design Pattern.

David to Scott: 'Hey'
Scott to David: 'I am good how about…


C# compiler allows using interfaces generic types.

Photo by Sora Shimazaki from Pexels

Learning Objective

  • How to create generic interfaces of type T
  • How to implements a generic interface in a non-generic class
  • How to implements a generic interface in a generic class


Please go through the basic concepts of generics for a better understanding of the article.

Getting Started

Let us understand how to create an…


According 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 Pexels

Use Case

Let's consider an example of two organizations merging; X organization is taking over Y, but while combining code, the interfaces are not compatible. …


The error occurs as a result of connection leaks in the application.

Photo by panumas nikhomkhai from Pexels

Any applications getting connection timeouts to MS-SQL Server will see the following error.

Message=Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and the max pool size was reached.

Most of the time, this…


According 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 Pexels

In other words, a change in one object initiates the notification in another object.

Use Case

Let’s take an example of an Instagram celebrity influence who has “x” number of followers. So the moment the celebrity adds a post, then all the followers are notified.

Let us implement the aforementioned use case…


Edit multiple lines of code at the same time

Tip 1: Box Selection

Let’s take an example of the following class with integer properties and apply box selection to update int to, let's say, double at one shot.

public class Test {
int x = 10;
int y = 20;
int z = 30;
int l = 40;

Shortcut Key: “Shift + Alt + down arrow (to select multiple rows).”

Isn’t it great..!!

So the box selection…

Sukhpinder Singh

Programmer by heart | C# | Python | .Net Core | Xamarin | Angular | AWS | Remember to 👏👏👏👏 Buy me a coffee

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store