AlgoViz

Adapter pattern

easy 50 min

The Adapter pattern makes an existing class fit the interface that its client expects, without changing either of them.

Watch lesson4:39

What each level should show

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

  • Junior

    Must show

    • Names the four participants
    • Writes an object adapter that works
    • Gives an everyday and a library example

    Will be probed on

    • Adapter or Decorator
    • What is the target here?

    Stands out

    Translates the error too, without being asked.

  • Mid

    Must show

    • Designs the target from the client
    • Compares object and class adapter
    • Tests with a recording fake

    Will be probed on

    • Units and order
    • A library that keeps state
    • Map or if chain

    Stands out

    Makes a gap list before writing code.

  • Senior

    Must show

    • Separates no from unknown
    • Keeps vendor types inside
    • Writes a contract test

    Will be probed on

    • Missing capability
    • Retries
    • Identity of wrapped objects

    Stands out

    Says which guarantee the adapter can not give.

  • Staff

    Must show

    • Plans a vendor change with a way back
    • Sets and enforces the border
    • Thinks about refunds, reports and webhooks

    Will be probed on

    • Two vendors at once
    • A leaking model
    • Nightly contract failures

    Stands out

    Removes layers as readily as adding them.