Introduction to Object-Oriented Design Patterns — Part -I

Introduction to Object-Oriented Design Patterns — Part -I

Image for postImage copied from http://www.deepakkamboj.com/design-patterns-for-software-developer-and-architect/

Why is the design pattern important?

Design patterns are Solving recurring design problems, In a nutshell, Design patterns are don`t solving the problem by themselves, They help us solving the problem.

Software development design patterns were started as best practices that were applied again and again to similar problems encountered in different contexts.

Examples of common problems solved by design pattern

  1. How to instantiate an object properly!
  2. How to interact between two objects!

What is a Design pattern?

Design pattern is a solution approach to a common problem, It should be an industry standard without language dependent

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn?t a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

What are all the benefits of the design pattern?

The truth is that you might manage to work as a programmer for many years without knowing about a single pattern. A lot of people do just that. Even in that case, though, you might be implementing some patterns without even knowing it. So why would you spend time learning them?

  1. Design patterns can speed up the development process by providing tested, proven development paradigms.
  2. Reusing the design patterns helps to prevent subtle issues that can cause major problems and it also improves code readability.
  3. Design pattern provides general solutions, documented in a format that doesn?t specifics tied to a particular problem.
  4. In addition to that patterns allows developers to communicate well-known, well-understood names for software interactions, Common design patterns can be improved over time, making them more robust than ad-hoc design.

5. A standard solution to a common programming problem enables large scale reuse of software.

Let?s see the classification of design patterns

Design Patterns Classification:

Design Pattern can be classified into three types

Creational design patterns

Structural design patterns

Behavioral design patterns

Image for postDesign patterns

The above image illustrates all classification of design patterns

Creational Design Patterns:

Creational design patterns are concerned with the way of creating objects. These design patterns are used when a decision must be made at the time of the instantiation of a class (i.e. creating an object of a class).

This pattern can be further divided into class-creation patterns and object-creational patterns. While class-creation patterns use inheritance effectively in the instantiation process, object-creation patterns use delegation effectively to get the job done.

Creational design patterns are mentioned in the above image.

Structural Design Patterns:

Structural design patterns are concerned with how classes and objects can be composed, to form larger structures. The structural design patterns simplify the structure by identifying relationships.

These patterns focus on, how the classes inherit from each other and how they are composed of other classes.

Structural class-creation patterns use inheritance to compose interfaces. Structural object-patterns define ways to compose objects to obtain new functionality.

Structural design patterns are mentioned in the above image.

Behavioral Design Patterns:

Behavioral design patterns are concerned with the interaction and responsibility of objects. In these design patterns, the interaction between the objects should be in such a way that they can easily talk to each other and still should be loosely coupled.

That means the implementation and the client should be loosely coupled to avoid hard coding and dependencies.

Behavioral design patterns are mentioned in the above image.

conclusion:

As we see the above contents are about introduction to design patterns and its importance in software development, Its not necessary to implement all of the design patterns in your software development, though you can leverage the appropriate design patterns to your problems in software development.

As mentioned design patterns are an implemented and tested solution, so if necessary you could design your own design pattern.

Thanks for Reading!

If any queries ask in the comments section!

20