Design Patterns vs. Architectural Patterns
This article is a term explanation of the difference between design patterns and architectural patterns – including exam questions and tags.
In a Nutshell
Design patterns solve recurring problems in code at the class/object level. Architectural patterns structure the overall application at a higher level.
Compact Technical Description
- Design Patterns: tactical solutions (e.g., Singleton, Factory, Observer).
- Architectural Patterns: strategic macro structure (e.g., MVC, Layered/n-Tier, Microservices).
Both improve maintainability and reusability, but at different levels.
Exam-Relevant Key Points
- Design patterns = class level
- Architectural patterns = system level
- Design Patterns are often part of architectural patterns
- Architecture decisions affect scalability/costs (IHK-relevant)
- Both must be justified and documented
Core Components
- GoF Patterns
- Creational/Structural/Behavioral patterns
- MVC
- Layered Architecture
- Microservices
- EDA
- DDD
- UML Documentation
Practical Example
// Design Pattern: Factory
class UserFactory {
public static User create(String name) {
return new User(name);
}
}
// Architectural Pattern: MVC
// Model = User.java, View = Frontend, Controller = Routing
Advantages and Disadvantages
Advantages
- Better readability/reusability (design patterns)
- Better teamwork/maintenance (architectural patterns)
Disadvantages
- Incorrect use leads to overengineering
- Architectural patterns increase initial effort
Typical Exam Questions (with Short Answer)
- What is a design pattern? Reusable solution at the class level.
- What is an architectural pattern? Structural approach for the entire software.
- How are they related? Design patterns are used within an architecture.
Free Response
In exams, it is important to recognize whether the question asks for a solution at the code level or for the overall structure. Good architecture uses appropriate design patterns without unnecessary complexity.
Learning Strategy
- Read patterns on Refactoring.Guru.
- Draw UML for a design pattern and an architectural pattern.
- Classify examples (design vs architecture).
- Avoid pattern-itis.
Topic Analysis
- Core: Structure
- Challenges: Complexity
- Security: Layer separation
- Documentation: Diagrams/Justification
- Cost-effectiveness: Long-term maintenance