Problem statement
Design the object model and core APIs for a tag taxonomy service that organizes media items under a hierarchy of tags, supports aliases, and lets an editor safely merge or rename tags.
Operating context. Single in-process service. Tags form a hierarchy: a tag has parents and children, and you must decide and defend whether it is a strict tree or a DAG. Each tag has a canonical name plus alias names that resolve to it. Media items are tagged by tag id in a many-to-many relationship. Editors rename a tag, add or remove parent-child links, alias one name to a canonical tag, and merge tag B into tag A by re-pointing B's items and children to A and turning B's name into an alias of A. Queries include listing every item under a tag including its descendants, and resolving an alias to its canonical tag. Cycles in the hierarchy must be impossible.
Out of scope. Search indexing and ranking, machine-learning auto-tagging, access control, any database or persistence layer, and UI autocomplete.
What to produce. The class hierarchy (tag, tag graph / taxonomy, alias resolver, item-tag index), the merge and rename operations, and the descendant-query model. Be explicit about: whether the hierarchy is a tree or a DAG and how cycles are prevented on every link, how aliases resolve to exactly one canonical tag, how merge atomically re-points items and children and preserves aliases, and how descendant queries stay efficient.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design LLD
- Media Tags
- Data Graph
- Algorithms Cycle-Detection
- Oop Solid