Hermes Wiki

Composite

Composes objects into tree structures and lets client code treat individual objects and groups of objects uniformly.

Why we need this / what value this brings

Lets client code treat a single item and a group of items the same way, simplifying code that would otherwise need special-casing for 'is this one thing or many'.

When to use this

Data that's naturally tree-shaped (categories with subcategories, nested comments) and needs uniform operations across all levels.

How to use or implement this

Define a common interface for both leaf and composite nodes, and have composite nodes delegate operations to their children.

Research questions

  • Category/subcategory trees for services (if Localz ever nests service categories) are a natural fit for this pattern.

Empty folder — drop notes, links, and findings here as you research.

Hermes Wiki