Debjeet Roy’s Post

View profile for Debjeet Roy, graphic

Built REST APIs with #Spring JPA and #Microservices | ex-EY | ex-CGI | AWS Cloud Practitioner | 7+ YOE | #Java Developer | Gold Badge in Hacker Rank🏅| Career Counsellor | Helping people to Code & Build Resumes

𝐖𝐡𝐚𝐭 𝐚𝐫𝐞 𝐃𝐞𝐬𝐢𝐠𝐧 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬 𝐢𝐧 𝐉𝐚𝐯𝐚?? > Design patterns are typical solutions to common problems in software design. They are like templates that can be applied to real-world programming situations to solve recurring design problems. > Design patterns can speed up the development process by providing tested, proven development paradigms. There are several types of design patterns: Creational, Structural, and Behavioral patterns. 𝟏. 𝐂𝐫𝐞𝐚𝐭𝐢𝐨𝐧𝐚𝐥 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬 These patterns provide ways to create objects while hiding the creation logic, rather than instantiating objects directly using a new operator. - **Singleton**: Ensures that a class has only one instance and provides a global point of access to it. - **Factory Method**: Defines an interface for creating an object, but lets subclasses alter the type of objects that will be created. - **Abstract Factory**: Provides an interface for creating families of related or dependent objects without specifying their concrete classes. - **Builder**: Separates the construction of a complex object from its representation so that the same construction process can create different representations. 𝟐. 𝐒𝐭𝐫𝐮𝐜𝐭𝐮𝐫𝐚𝐥 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: These patterns deal with object composition or the way to compose objects to form larger structures. Structural patterns use inheritance to compose interfaces to obtain new functionalities. - Adapter: Allows objects with incompatible interfaces to work together by wrapping an interface around one of the existing objects. - Composite: Composes objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. - Decorator: Adds additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. - Facade: Provides a unified interface to a set of interfaces in a subsystem, making the subsystem easier to use. 𝟑. 𝐁𝐞𝐡𝐚𝐯𝐢𝐨𝐫𝐚𝐥 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬 These patterns are concerned with algorithms and the assignment of responsibilities between objects. - **Chain of Responsibility**: Passes a request along a chain of handlers. Each handler decides either to process the request or to pass it to the next handler in the chain. - **Iterator**: Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. - **Observer**: Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. - **Template Method**: Defines the skeleton of an algorithm in the superclass but lets subclasses override specific steps of the algorithm without changing its structure. Understanding these patterns and knowing when and how to use them can greatly enhance your design and coding efficiency. #job #designpattern

  • No alternative text description for this image

To view or add a comment, sign in

Explore topics