The design patterns rule category contains common patterns for
designing and writing source code, including some of the classic Gang of Four
patterns.
| Pattern |
Purpose |
| Decorator |
This pattern adds responsibilities to an object dynamically, without
changing its interface. The Decorator pattern acts as a wrapper because it
implements the original interface, adds capabilities, and delegates work to
the original object, so that you can use it as an alternative to creating
a subclass. The architectural discovery algorithm identifies this pattern
as consisting of two classes: the decorator class and the wrapped component. |
| Factory Method |
This pattern defines an interface for creating objects without knowing
the class of the object it creates. Each Factory Method pattern can define
the class to be instantiated based on the input parameters and specifics of
the situation. The architectural discovery algorithm identifies this pattern
as consisting of a Creator class, a Concrete Creator subclass, a Product interface,
and a Concrete Product object. The Creator class specifies the interface for
creating a Product interface. The Concrete Creator subclass implements this
interface by instantiating a Concrete Product object. |
| Marker |
This pattern declares a semantic attribute of a class. The architectural
discovery algorithm identifies the Marker pattern as a single empty interface
without methods or constants. |
| Observer/Observable |
This pattern communicates the changes in the state of an object to
other system objects. The architectural discovery algorithm identifies this
pattern as consisting of Observer and Observable classes. The Observable class
maintains a list of Observer classes that it notifies when a state change
occurs. |
| Singleton |
This pattern ensures that a class allows only one object instance.
The architectural discovery algorithm identifies the Singleton pattern as
a class with a private constructor and a public static field or method that
provides global access to the instance of a Singleton class. |
| Utility |
This pattern models a stateless utility function. The architectural
discovery algorithm identifies Utility as a class with a private constructor
that contains only static methods. |
| Visitor |
This pattern performs specific operations on the elements of an object
structure. The Visitor pattern allows additional operations without changing
the classes of the elements on which they operate. The architectural discovery
algorithm identifies the Visitor pattern as consisting of a Visitor class,
a Concrete Visitor subclass, an optional Element class, and a Concrete Element
subclass. The Visitor pattern is an interface that declares the Visit operation
for every element. The Concrete Visitor subclass implements the Visitor interface
and acts on each Concrete Element subclass. |