Skip to content

jimmckeeth/DelphiPatterns

Repository files navigation

DelphiPatterns

This project should represent a complete set of all the GoF design patterns implemented in Delphi.

Originally created by Elector and published to delphipatterns.codeplex.com (Archive link), but is no longer available there.

Each pattern is implemented in separate directory & project. The pattern is in the*.pattern.pas file, while the example is in the *.example.pas file.

List of Patterns

Each included pattern, links to the files, and a short description. Read more on Wikipedia.

Most behavioral design patterns are specifically concerned with communication between objects.

Patterns that create objects, rather than having to instantiate objects directly. This gives the program more flexibility in deciding which objects need to be created for a given case.

Patterns that concern class and object composition. They use inheritance to compose interfaces and define ways to compose objects to obtain new functionality.

  • Adapter [Usage] - allows classes with incompatible interfaces to work together by wrapping its own interface around that of an already existing class. [more info]
  • Bridge [Usage] - decouples an abstraction from its implementation so that the two can vary independently. [more info]
  • Composite [Usage] - composes zero-or-more similar objects so that they can be manipulated as one object. [more info]
  • Decorator [Usage] - dynamically adds/overrides behavior in an existing method of an object. [more info]
  • Facade [Usage] - provides a simplified interface to a large body of code. [more info]
  • Proxy [Usage] - provides a placeholder for another object to control access, reduce cost, and reduce complexity. [more info]

ToDo

  • Creational
    • Prototype Implementation missing - creates objects by cloning an existing object. [more info]
    • Dependency Injection - class accepting the objects it requires from an injector instead of creating the objects directly.
    • Lazy initialization (aka Virtual Proxy) delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed.
    • Multiton Ensure a class has only named instances, and provide a global point of access to them.
    • Object pool Avoid expensive acquisition and release of resources by recycling objects that are no longer in use.
  • Structural
    • Delegation - Extend a class by composition instead of subclassing. The object handles a request by delegating to a second object (the delegate)
    • Flyweight Implementation missing - reduces the cost of creating and manipulating a large number of similar objects. [more info]
  • Other
    • Many more...

License

The license is still Common Development and Distribution License (CDDL), the same as the original implementation. According to FOSSA it has similar provisions to the Mozilla Public License 2.0 and the Eclipse Public License.

About

Complete set of all the GoF design patterns implemented in Delphi language

Resources

License

Stars

Watchers

Forks

Languages