satcom/code-pattern icon
public
Published on 7/29/2025
Code Patterns and data structure

Rules

rules:

Creational Patterns

  • name: Factory Method rule: Use the Factory Method pattern when object instantiation should be deferred to subclasses without modifying the client code.

  • name: Abstract Factory rule: Use the Abstract Factory pattern when creating families of related objects without specifying their concrete classes.

  • name: Builder rule: Use the Builder pattern when creating complex objects step-by-step with different representations.

  • name: Prototype rule: Use the Prototype pattern when new objects are created by copying existing instances, especially when construction is expensive.

  • name: Singleton rule: Use the Singleton pattern sparingly when only one instance of a class should exist globally.

Structural Patterns

  • name: Adapter rule: Use the Adapter pattern to bridge incompatible interfaces so they can work together without modifying original code.

  • name: Bridge rule: Use the Bridge pattern to separate abstraction from implementation and allow both to evolve independently.

  • name: Composite rule: Use the Composite pattern when working with tree structures where individual and grouped objects are treated uniformly.

  • name: Decorator rule: Use the Decorator pattern to dynamically extend object functionality without modifying its class.

  • name: Facade rule: Use the Facade pattern to expose a simplified interface to a complex subsystem.

  • name: Flyweight rule: Use the Flyweight pattern to minimize memory usage by sharing common parts of object state across many instances.

  • name: Proxy rule: Use the Proxy pattern to control access to another object, e.g., for lazy loading, caching, or access control.

Behavioral Patterns

  • name: Chain of Responsibility rule: Use Chain of Responsibility to pass a request through a chain of handlers that can decide to handle or delegate it.

  • name: Command rule: Use the Command pattern to encapsulate requests as objects, allowing parameterization, queuing, or undo functionality.

  • name: Interpreter rule: Use the Interpreter pattern to define a grammar and interpret sentences in a language using an expression tree.

  • name: Iterator rule: Use the Iterator pattern to sequentially access elements in a collection without exposing the underlying structure.

  • name: Mediator rule: Use the Mediator pattern to centralize complex communications and control logic between objects.

  • name: Memento rule: Use the Memento pattern to capture and restore the internal state of an object without exposing its internals.

  • name: Observer rule: Use the Observer pattern when multiple objects should be notified of state changes in a subject.

  • name: State rule: Use the State pattern to encapsulate state-specific behavior and allow the object to change behavior as its internal state changes.

  • name: Strategy rule: Use the Strategy pattern to define a family of algorithms that can be selected at runtime, encapsulated in separate classes.

  • name: Template Method rule: Use the Template Method pattern to define the skeleton of an algorithm and let subclasses override specific steps.

  • name: Visitor rule: Use the Visitor pattern to perform operations across a set of objects without changing their classes.