Design Patterns GoF — Delphi

Implement GoF design patterns in Delphi with T/I/E/F/A/L naming and try..finally.

48|12|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/delphicleancode/delphi-spec-kit --skill design-patterns-gof-delphi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Design Patterns GoF — Delphi
Source: https://github.com/delphicleancode/delphi-spec-kit/tree/main/.gemini/skills/design-patterns
Command: npx skills add https://github.com/delphicleancode/delphi-spec-kit --skill design-patterns-gof-delphi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a comprehensive GoF design-pattern library for Delphi, enabling developers to adopt SOLID, interface-driven solutions instead of ad-hoc implementations.

Core Features & Use Cases

  • Creational patterns: Singleton, Factory, Abstract Factory, Builder.
  • Structural patterns: Adapter, Decorator, Facade, Proxy.
  • Behavioral patterns: Strategy, Observer, Command, Template Method, State.
  • Emphasizes Delphi conventions (naming: T/I/E/F/A/L) and robust memory management with try..finally.
  • Real-world usage: architectures that benefit from clean separation of concerns and maintainable, testable code.

Quick Start

Start by selecting a GoF pattern (e.g., Factory) and implement a Delphi module following the T/I/E/F/A/L naming and try..finally memory management.

Frequently Asked Questions about Design Patterns GoF — Delphi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement GoF design patterns in Delphi while following SOLID principles?

GoF design patterns in Delphi are implemented using interface-driven solutions and TInterfacedObject-based classes to enforce SOLID principles. This approach replaces ad-hoc implementations with structured, reusable object-oriented code across Creational, Structural, and Behavioral categories.

What Delphi naming conventions and memory management practices are required for design patterns?

Delphi design pattern implementations require the T/I/E/F/A/L naming conventions for classes and interfaces, paired with robust memory management using try..finally blocks. This ensures disciplined resource handling and prevents memory leaks in object-oriented architectures.

When do I need to use the Factory or Strategy pattern in a Delphi application?

You need the Factory pattern in Delphi when encapsulating object creation logic, and the Strategy pattern when swapping algorithms at runtime without modifying clients. Both enable clean separation of concerns and maintainable, testable code.

Can I use TInterfacedObject to build Delphi Singleton and Observer classes?

Yes, TInterfacedObject-based implementations are used to build Delphi Singleton and Observer classes. By leveraging interfaces, these patterns achieve reference-counted memory management and decoupled communication between objects.

Are there Delphi examples for structural patterns like Adapter, Decorator, and Facade?

The skill provides concrete Delphi examples for structural patterns including Adapter, Decorator, Facade, and Proxy. These patterns help adapt interfaces, add responsibilities dynamically, and simplify complex subsystem interactions.

What is the best way to separate concerns in Delphi object-oriented projects?

The best way to separate concerns in Delphi is applying GoF behavioral patterns like Command, Template Method, State, and Chain of Responsibility. These patterns decouple request handling and state transitions for maintainable architectures.