Learning C# Design Patterns Series -Why Design Patterns

Design Patterns - The Best Practices

Few years back, design patterns for .net developers were less known though it is widely being used by java developers.

So as .net languages and developers got more matured over the time, people started looking for .net code optimization, performance, best practices, extensibility and maintainability of the code side.

First obvious question about making use of design patters is why? Why we should implement design patterns in our solutions/applications.

Well I will try to read and make notes of why and how of design patterns and share in this series. So let begin.

1. Why design patterns? What benefit I will get?

Productivity: Design pattern helps to build an architecture which can enhance the productivity.

Extensibility: When a software is released and becomes successful and widely accepted it is obvious that it will receive lots of request change and updates. So if while building the application proper design patterns is implented it will be easy to supply those updates and request. Most design patterns promote the idea of coding against interfaces and base classes, which makes it easier to change and enhance your application at a later stage.

Simplicity: Our solution architecture should be simple, well thought out, clean, crisp and easy to understand. This can be acheived by knowing the design pattern in advance.

Elegence: Code should be easy to navigate, self documenting and it should be 'read like a story'. All the design patterns promote this basic idea of constructing elegant solutions.

Mainainability: Code which is simple and elegence, can be easily understood, supported and maintained.

Enterprise architecture: With the proven design patterns and practices, it is easier to develop enterprise applications. If we are going to build an application which is going to have thousands of concurrent users it is expected to consider all the complex issues such as scalability, redundancy, fail-over, security, transaction management, performance, error handling, logging, caching, data compression and lot more. So if we are involved in building comprehensive and business critical systems, it is expected to have knowledge of design patterns and best pracitces.

Design patterns can be classified in 3 different categories:

Creational Patterns

  • Abstract Factory Pattern
  • Builder Pattern
  • Factory Method Pattern
  • Prototype Pattern
  • Singleton Pattern

Structural Patterns

  • Adapter Pattern
  • Bridge Pattern
  • Composite
  • Decorator
  • Facade
  • Flyweight
  • Proxy

Behavioral Patterns

  • Chain of Responsibility
  • Command
  • Interpreter
  • Iterator
  • Mediator
  • Memento
  • Observer
  • State
  • Strategy
  • Template Method
  • Visitor

So in the coming series we will see implementation of some of the very popular design patterns like singleton, factory, abstract factory, observer, iterator, decorator, adaptor, strategy and more.

Link: Discover the design patterns you are already using in .net framework

blog comments powered by Disqus

Posts By Month