What are Design Patterns?
Design Patterns are simply sets of standardized practices used in the software development industry. They represent solutions, provided by the community, to common problems faced in every-day tasks regarding software development.
There's a myriad of design patterns, and you're probably familiar with some of them already. Being familiar with them and knowing them by heart can help you increase the speed and quality of your development.
By using already clearly defined approaches instead of reinventing the wheel, as well as well-known industry standards you both help your team and yourself produce high-quality applications that are easier to maintain and improve.
Another important thing to mention is the uniformity and universality. Instead of explaining a common concept to someone else, you can simply tell them to utilize a certain pattern.
Most of these patterns apply to multiple languages, not just Java, but some, like the J2EE Design Patterns are applicable mostly to Java, or rather Java EE.
There are three main design pattern categories: Creational Patterns, Structural Patterns and Behavioral Patterns, but we'll also dive into J2EE Patterns.
Creational Patterns, as the name implies, are most concerned about solutions and options revolving around instantiating objects, and how to do so more efficiently in the most varied of circumstances.
Structural Patterns are concerned about providing solutions and efficient standards regarding class compositions and object structures. Also, they rely on the concept of inheritance and interfaces to allow multiple objects or classes to work together and form a single working whole.
Behavioral Patterns are concerned about providing solutions regarding object interaction - how do they communicate, how are some dependent on others, and how to segregate them to be both dependent and independent and provide both flexibility and testing capabilities.
J2EE Patterns are concerned about providing solutions regarding Java EE. These patterns are widely accepted by other frameworks and projects, like for an example Spring.
Design Patterns in Java
In that name, we've compiled a list of all the Design Patterns you'll encounter or use as a software developer, implemented in Java.
- Template Method/Pattern
- Chain of Responsibility