AlgoViz

Chain of responsibility

medium 45 min

A request travels past several handlers until one takes it, or until one stops it.

Watch lesson4:36

What each level should show

The same question is judged differently for mid, senior and staff.

  • Junior

    Must show

    • Names handler, next, client
    • Writes a base class with the passing on
    • Says what happens at the end

    Will be probed on

    • Forgotten return
    • Why not ifs

    Stands out

    Names a case where a map is better.

  • Mid

    Must show

    • Separates dispatch, filter and pipeline
    • Keeps the order in one place
    • Compares with Decorator

    Will be probed on

    • setNext returns the last
    • Same handler in two chains

    Stands out

    Uses a list and explains the trade.

  • Senior

    Must show

    • Middleware with before and after
    • Order rules with reasons
    • Failure per link, deadline, trail

    Will be probed on

    • next called twice
    • Change under load

    Stands out

    Proves the order with declared needs.

  • Staff

    Must show

    • Chains per tenant with versions
    • Shadow runs and safe removal
    • Index that keeps first match

    Will be probed on

    • Rules as data
    • Reordering overlapping rules

    Stands out

    Plans who owns the order and how a mistake is seen.