Skip to content
IRC-Coding IRC-Coding
Design Patterns Singleton Factory Observer Adapter Strategy

Design Patterns Explained: GoF Categories & Exam Questions

Master design patterns: creational, structural, behavioral. Learn Singleton, Factory, Observer, Adapter, Strategy with examples.

S

schutzgeist

2 min read

Software Architecture: Design Patterns

This article is a definition of terms for Design Patterns – including exam questions, core components, and tags.

In a Nutshell

Design Patterns are reusable solution approaches for common problems in object-oriented software development. They improve structure, maintainability, and communication.

Compact Technical Description

GoF patterns are often divided into three categories:

  • Creational Patterns (e.g. Singleton, Factory)
  • Structural Patterns (e.g. Adapter, Facade, Proxy)
  • Behavioral Patterns (e.g. Observer, Strategy, Command)

Patterns are not finished classes, but concepts that can be implemented in many languages. They create a common vocabulary within a team.

Exam-Relevant Key Points

  • Categories: Creation, Structure, Behavior
  • Reusable solutions
  • Decoupling and extensibility
  • Practical relevance (Java, C#, Python)
  • Security: e.g. Singleton for centralized access control
  • Cost-effectiveness: less development time
  • Documentation: pattern selection + diagrams

Core Components (Examples)

  1. Singleton
  2. Factory Method
  3. Observer
  4. Adapter
  5. Strategy
  6. Decorator
  7. Proxy
  8. Command
  9. Facade
  10. Builder

Practical Example (Singleton in Python)

class Logger:
  _instance = None
  def __new__(cls):
    if cls._instance is None:
      cls._instance = super().__new__(cls)
    return cls._instance

Advantages and Disadvantages

Advantages

  • Proven solution approaches
  • Unified language within the team
  • Decoupling
  • Maintainability

Disadvantages

  • Incorrect usage creates complexity
  • Over-engineering for small problems

Typical Exam Questions (with Short Answer)

  1. What is a Design Pattern? A proven solution template for a recurring design problem.
  2. What categories exist? Creational, structural, and behavioral patterns.
  3. What distinguishes Singleton? Exactly one instance per application context.
  4. When do you use Observer? When multiple objects should react to changes.

Free-Form Answer

Patterns are useful when they solve a concrete problem. In project documentation, you can use them to demonstrate structured design – but don’t practice “pattern-itis”.

Learning Strategy

  1. Learn 3–5 patterns + understand their roles.
  2. Implement 2 patterns yourself.
  3. Practice explaining usage and benefits in 5 lines.
  4. Use patterns only when there is genuine need.

Topic Analysis

  • Core: Design patterns
  • Challenges: Roles/overhead
  • Security: Access control
  • Documentation: Pattern justification
  • Cost-effectiveness: Reusability

Further Information

  1. https://refactoring.guru/design-patterns
  2. https://sourcemaking.com/design_patterns

Design Patterns

Books about design patterns and software design

Design Patterns von Gang of Four

Design Patterns von Gang of Four

Bei Amazon ansehen

Affiliate-Link: Bei einem Kauf erhalten wir möglicherweise eine Provision.

Patterns of Enterprise Application Architecture von Martin Fowler

Patterns of Enterprise Application Architecture von Martin Fowler

Bei Amazon ansehen

Affiliate-Link: Bei einem Kauf erhalten wir möglicherweise eine Provision.

Refactoring von Martin Fowler

Refactoring von Martin Fowler

Bei Amazon ansehen

Affiliate-Link: Bei einem Kauf erhalten wir möglicherweise eine Provision.

Back to Blog
Share:

Related Posts