First of all, why do we need Design Pattern?
So, here is the answer, In software engineering, A design pattern is a generic, repeatable solution to a frequent issue in software design. Design patterns are essentially used to solve problems in a way that ensures your code is reusable, loosely coupled, and highly maintainable. To put it simply, they are templates rather than solutions.
Design Patterns make your application most robust and loosly coupled so it should be extainable in a larger scale without making more changes in your code. So basically, you can modify or update your software application with an easier implememtaion at any point of time.
And What’s Next?
Solutions may vary depending on the issues. How can we determine which design pattern or template will most effectively address our problem?
In that situation, we have many design patterns that address various issues.
Awesome 🙂 . Then why not we learn more about it
Design patterns provide the three different way to solve different kind of problems.
lets discuss one by one !!
1- Structural Design Pattern
It deals with class structure, like how to organize different classes and objects to form larger structures and provide new functionality. This patterns focus on decoupling interface and implementation of class and it’s object.
Bit Confuse 😦 , right ?
Lets make it more simple with some real time examples and see what kind of problem we can solve by using Structural Design Patter.
Example -1 : Assume you need to integrate some other applications that only speak German and you have one application that only understands English.
How will your app be able to communicate with other apps.
You definitely need a translator who is fluent in both German and English. In this manner, your application sends the data to the mediator in English, the mediator converts it to German, and then your German-only application receives it, and vice versa.
You can see from the example above how we organised many classes to create a huge structure that offers new capabilities between our application and other applications (which can convert Engilsh to German and vice versa).
This kind of problem we can solve by using Structural Design Pattern.
Types Of Structural Design Pattern

Example-1 comes under Adapter Design Pattern, Will discuss more about others design pattern in next chapter.
2- Creational Design Pattern
Creational Design Pattern deals with class instatiation and object creation. Here we are using two things one is class creation (parent to child) and object creation. Class creation use inheritence and object creation use delegetion effectively to get the job done.
Uff. 😦 what does it mean ??
Don’t worry ! here are some examples by which you can easily get to know what it is.
Keep Patience 🙂
Example -1.1 , Consider that your tiny workplace only has one password-protected printer. Therefore, in order to print paper, a user must input their password to unlock the printer..
Is this a workable solution? No, good. When your employee comes to print something, they must enter their password each time, which is tedious for them. What occurs if a password is forgotten? Need to ask another person…
Think about the solution 😉
Provide a single instant of the printer, which implies that after the first unlocking and configuration, each employee should be allowed to use it.
Easy, right 😀
Types of Creational Design Pattern

3- Behavioral Design Pattern
It deals communication between the classes and objects. How one class interact with other class.
Really ? do claases also communicate between each others. ?? Yes. lets see how :B
First, understand it with real life example 😀
Example -1.2 Let’s say you constructed a two-room home on your own with certain square measurements. You recently purchased some new furniture, a new wardrobe, etc. after two years. What should you do now that your room is entirely occupied?
Will you make your room larger? Is that even possible?
What will happen if you purchase additional items for your room? Will you need to further expand your room?
Therefore, it would be better if you built another room that connects to your current room rather than extending your current room. In this manner, you can improve/increase your personal possessions and connect your old room (Class-1) with your new room (Class-2). Happy 😀 🙂
Types of Behavioral Design Pattern
