Architecture:MediaWiki/Pattern language

Classes in the MediaWiki code base use the pattern language outlined below. As per version 1.35, the pattern language is aspirational. That is, the patterns described here do not describe current reality, but are intended as a guide for creating new code and for improving existing code.

Patterns, in no specific order:



Patterns

edit

These patterns serve as reusable solutions to common problems encountered in software architecture and design. While some patterns are specific to certain technical layers, others can be applied across multiple layers, enhancing the flexibility and maintainability of the codebase. This overview categorizes and describes each pattern, offering insights into their applications and potential restrictions.


Entry Point Pattern

edit

Defines a clear entry point for application execution, ensuring that the application starts predictably.


Wiring Pattern

edit

Involves the configuration of components and their dependencies, often utilizing hook handlers to manage events and interactions.


View Pattern

edit

Separates the presentation layer from the business logic, allowing for a clean and maintainable user interface.

Cursor Pattern

edit

Utilizes iterators to traverse collections of data, providing a consistent way to access elements without exposing the underlying structure.


Batch Pattern

edit

Processes a group of items together, optimizing performance and resource usage by minimizing the number of transactions.


Pager Pattern

edit

Facilitates the navigation of large datasets by dividing them into manageable pages, improving user experience and performance.


Input Form Pattern

edit

Standardizes the creation and validation of input forms, ensuring consistent data collection and user interaction.


Service Object Pattern

edit

Encapsulates business logic within service objects, promoting separation of concerns and enhancing testability.


Stateless Service Pattern

edit

Designs services that do not maintain state between requests, allowing for scalability and easier management.


Service Container Pattern

edit

Manages the instantiation and lifecycle of service objects, providing a centralized location for dependency injection.


Data Access Object Pattern

edit

Abstracts the data access layer, providing a consistent interface for interacting with data sources.


Lookup Pattern

edit

Facilitates the retrieval of objects or services based on a key, promoting loose coupling and flexibility.


Factory Pattern

edit

Creates objects without specifying the exact class of the object being created, promoting encapsulation and flexibility.


Registry Pattern

edit

Maintains a centralized registry of objects, allowing for easy access and management of shared resources.


Handler Pattern

edit

Defines a mechanism for processing requests or events, often used in conjunction with other patterns.


Content Handler Pattern

edit

Manages the processing and rendering of content, ensuring that the correct format and structure are applied.


API Module Pattern

edit

Encapsulates the functionality of an API, providing a clear interface for interaction with external systems.


Action Pattern

edit

Defines a specific action or command that can be executed, often associated with user interactions.


Special Page Pattern

edit

Handles unique or specialized pages within an application, providing tailored functionality and presentation.


Media Handler Pattern

edit

Manages the processing and delivery of media content, ensuring compatibility and performance.


Page Pattern

edit

Defines various types of pages within an application, promoting consistency in structure and behavior.


Provider Pattern

edit

Offers a way to supply dependencies or services, often acting as a factory for creating instances.


Codec Pattern

edit

Handles the serialization and deserialization of data, ensuring compatibility between different formats.


Command Pattern

edit

Encapsulates a request as an object, allowing for parameterization and queuing of requests.


Validator Pattern

edit

Standardizes the validation of input data, ensuring that it meets specified criteria before processing.


Formatter Pattern

edit

Handles the formatting of data for presentation, ensuring consistency and adherence to standards.


Skin Pattern

edit

Allows for the customization of the user interface, enabling different visual styles without altering functionality.


Renderer Pattern

edit

Manages the rendering of content, separating the logic of content generation from its presentation.


Localizer Pattern

edit

Facilitates the translation and localization of content, ensuring that applications can support multiple languages.


Builder Pattern

edit

Encapsulates the construction of complex objects, allowing for step-by-step creation and configuration.


Event Pattern

edit

Defines a mechanism for event-driven programming, allowing components to communicate through events.


Listener Pattern

edit

Handles the subscription and response to events, promoting decoupling between event producers and consumers.


Job Pattern

edit

Encapsulates a unit of work that can be executed asynchronously, promoting scalability and responsiveness.


Data Update Pattern

edit

Manages the process of updating data, ensuring consistency and integrity throughout the application.


Output Aggregator Pattern

edit

Combines multiple outputs into a single response, optimizing performance and resource usage.


Data Object Pattern

edit

Represents a data structure, often used to transfer data between layers of an application.


Record Pattern

edit

Defines a data structure with a unique identifier, facilitating easy retrieval and management.


Immutable Value Pattern

edit

Creates objects that cannot be modified after creation, promoting safety and predictability.


Exception Pattern

edit

Consistently handles error conditions, promoting robustness and maintainability.


Active Record Anti-Pattern

edit

Identifies the pitfalls of using an active record pattern, where business logic and data access are tightly coupled.


Content Pattern

edit

Manages the representation and processing of content, though its relevance may be diminishing.


Parser Pattern

edit

Facilitates the interpretation and processing of structured data, ensuring that it can be transformed into usable formats.


Cache Pattern

edit

Improves performance by storing frequently accessed data in memory, reducing the need for repeated data retrieval.


Writer Pattern

edit

Handles the output of data, ensuring that it is formatted and delivered correctly.


Hook Handler Pattern

edit

Manages hooks within the application, allowing for extensibility and customization.


Client Object Pattern

edit

Encapsulates the interaction with external services or APIs, promoting separation of concerns.


Adapter Pattern

edit

Facilitates compatibility between incompatible interfaces, allowing for seamless integration.


Maintenance Script Pattern

edit

Defines scripts for performing maintenance tasks, ensuring that they are executed consistently and reliably.


Conclusion

edit

While some patterns may be confined to specific technical layers, others can be leveraged across multiple layers, providing flexibility and promoting best practices in software design.


Some patterns may be confined to technical layers, but others may be applicable on all layers. Some layers may have restrictions on what other patterns they can make use of.