Design patterns in Java
Learn all about Design patterns in Java
This Article works as an index to all the design patterns articles written in this publication.
- Design patterns are general reusable solutions to commonly occurring problems.
- It is a description or a template for how to solve a problem that can be used in many different situations.
- The best practices that a programmer can use to solve common problems when designing an application or system.
“A design that doesn’t take change into account risks major redesign in the future.” ― Erich Gamma
- Design patterns can speed up the development process by providing tested, proven development paradigms.
- Reusing design patterns helps to prevent subtle issues that can cause major problems.
- Improve code readability for coders and architects.
- Design patterns provide general solutions, documented in a format that does not require specifics tied to a particular problem.
Types of Design Patterns
Creational Design Pattern
Creational patterns are focused towards How to instantiate an object or group of related objects.
In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.
Structural Design Patterns
Structural patterns are mostly concerned with object composition or in other words how the entities can use each other. It answers “How to build a software component?”
In software engineering, structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.
Behavioral Design Patterns
It is concerned with assignment of responsibilities between the objects. It answers “How to run a behavior in software component?”
What makes them different from structural patterns is they don’t just specify the structure but also outline the patterns for message passing/communication between them.
In software engineering, behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.
- Chain of Responsibility
- Template Method