Tag: .Net Design Patterns

Introduction to SignalR

What is ASP.Net SignalR SignalR is a Technology that enable Real-Time messages/contents to be pushed from server to connected web clients without the need to refresh the web pages every specific period of time. In the old days, we used to have schedule timer on client side to request new data from server every specific period Read More …

SOLID Object-Oriented-Design Principles

One of the main principles of OOD (Object Oriented Design) is SOLID principles. SOLID is stands for : 1. Single Responsibility Principle: This means the class has to have one and only one reason to responsibility. This responsibility should be encapsulated by the class. 2. Open/closed principle: The open/closed principle states that software entities (classes, modules, functions, …etc) should be Read More …

State Design Pattern

Introduction: Sometimes you want to build a class where its behavior changed according to its state. State Design pattern provides a good class structure to solve this issue. State Design pattern also known as Object for state pattern is used to represent the state of an object and the object behavior will changed according to Read More …

Command Design Pattern

Introduction: Command Design Pattern enables you to encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations. Example: The below code demonstrates the Command pattern to be used on a simple calculator. This caluclator doing unlimited number of undo’s & Redo’s . One Read More …

Iterator Design Pattern

Introduction: Sometimes you want to access a collection of objects in a sequential way without even expose how things is going inside your implementation . Iterator Design Pattern Provides you with a Skelton of how to design your classes to solve this issue. Example: static void Main(string[] args) { ListAggregate a = new ListAggregate(); a[0] Read More …

Mediator Design Pattern

Introduction: Sometimes you want to design your classes set that interact with each other in a loosely coupled manner by keeping your classes away from referring each other directly… Mediator Design Pattern solve this issue by promoting the idea of loosely coupling classes Example:   static void Main(string[] args) { CountryList countrylist = new CountryList(); Read More …

Interpreter Design Pattern

Introduction: Sometimes you want to define a grammar for special language for certain reasons. After defining the syntax of this language, you need to build an interpreter to interpret the language and do actions accordingly. Interpreter Design Pattern help you to define a well structure object oriented classed to parse your expressions against the new Read More …

Proxy Design Pattern

Introduction: Sometimes you become into a case where you does not or can not reference an object directly, but you still want to interact with that object to do some job. The intent of the proxy design pattern is to control access to an object by providing placeholder for it. Below example will make the Read More …

Flyweight Design Pattern

Introduction: Flyweight design pattern target to minimizes the memory usage by sharing as much data as possible with other similar objects. It is very useful when have large amount of objects in memory which have lot of similar values. by sharing the similar values between all the objects, memory usage will be much less. Example: Read More …

Façade (Facade) Design Pattern

Introduction: Façade is one of the most used design patterns on software industry. Basically it is about providing a simple interface for large body of code, like class library and it will help you on : Make large body of code easier to be understand. Make client code more readable. Reduce dependency of client code Read More …