1
CHAPTER 0
DESIGN PATTERNS
INTRODUCTION
Common Design Patterns in C# 4.0
Design Patterns provide standardized and efficient solutions to software design and programming
problems that are re-usable in your code. Software Architects and developers use them to build high
quality robust applications.
However, you have to take care to select the right pattern for the right problem. If you need to modify
the initial pattern too much, this may indicate that it is not adapted to your needs and may in the worst
case lead to unmaintainable, complex and inefficient code. The opposite of what you intend when using
Design Patterns!!
You may also create your own custom Design Patterns. Whenever you come up with a certain solution
that is reusable in a vast majority of your projects, you may decide to abstract a design pattern out of it.
Then you may create your own library of patterns and share them within your whole company, thus
creating standards and ameliorating maintainability.
Authoring software requires a set of rules and methodologies to take your idea to center point without any
rework for future enhancements. In Software Engineering, we have a set of principles stated by Robert
Martin called SOLID principle. SOLID word has principles as Single Responsibility, Open Close, Liskov’s
Substitution, Interface Segregation and Dependency Inversion. Let me explain you about SOLID as one word
SOLID
Single Responsibility Principle – There should be a one strong reason to change the class.
Open/Close Principle – Entities should open only for adding new functionality and Close for any updates after
testing phase.
Liskov’s Substitution Principle – Functions accessing base class must be able to access derived class
Interface Segregation Principle – Clients should use Interface members completely.
Dependency Inversion Principle – High level modules and Details should depend on abstractions only.
Other Main Principles of Software design Engineering is
Dry (Don’t Repeat Yourself): Code should occur exactly once in the system.