Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Catalogs common Java design patterns such as Factory, Builder, Strategy, Observer and Decorator, with code examples.
Use this skill ↓91% 91%0 ptsof test cases passed
Passed 21 of 23 test cases with the skill, and 21 of 23 without it.
3 of 3 safety checks passed
Not used yet
Practical design patterns reference for Java with modern examples.
| Problem | Pattern |
|---|---|
| Complex object construction | Builder |
| Create objects without specifying class | Factory |
| Multiple algorithms, swap at runtime | Strategy |
| Add behavior without changing class | Decorator |
| Notify multiple objects of changes | Observer |
| Ensure single instance | Singleton |
| Convert incompatible interfaces | Adapter |
| Define algorithm skeleton | Template Method |
Use when: Object has many parameters, some optional.
// ❌ Telescoping constructor antipattern
public class User {
public User(String name) { }
public User(String name, String email) { }
public User(String name, String email, int age) { }
public User(String name, String email, int age, String phone) { }
Next to this one in the catalogue, plus more from the same author.