Architecture:MediaWiki/output aggregator pattern
|This page is under construction|
Please help review and edit this page.
The output aggregator pattern describes object that are used to construct a string intended for output, typically HTML. Output aggregators may also construct additional auxiliary information, e.g. concerning the cacheability of the output.
Output aggregators have one or more methods for contributing to the output, and one or more methods to access the resulting output and associated information.
While trivial output aggregators may be constructed directly, it is generally wise to design them to be obtained them from some kind of factory. This way, service objects for e.g. localization can be injected.
- While an output aggregator may be a data objects, this is not necessary. In particular, an output aggregator may use service objects internally. Because of this, output aggregators may or may bot be serializable.
- The builder pattern is conceptually similar to the output aggregator. However, builders will typically construct a value object, while output aggregators (primarily) construct a string intended for output, along with auxiliary information.
- Views may use the output from an output aggregator, or may contribute output to an output aggregator (or both).
- Skins may use the output from an output aggregator, or may contribute output to an output aggregator (or both).
- Renderers often contribute output to an output aggregator.
No naming convention is established. The suffix "Aggregator" is suggested for new instances of this pattern.
As of May 2020, the output aggregator pattern is well established, though not widely used.