ADAPTER / PRACTICE
One player.
Different library languages.
You met Adapter through weather data. Now connect an older audio library to an existing player.
YOUR MISSION / AUDIO LIBRARIES
The music fits.
The interface does not.
Your player calls load(id). The older library only offers findTrack(id), milliseconds and access codes. Connect them without teaching the player vendor-specific rules.
length_ms: 185000access_code: "ok"Player expectsdurationSeconds: 185playable: truePreserve the track’s meaning, not just its field names. Unsupported codes must produce an error, not a guessed permission.
01 / DESIGN THE TRANSLATION
Make three design choices.
Choose who owns the mismatch, then decide how to translate the values. Your choices run in every legacy-library test.
Try your own design first. Hints and retries are unlimited.
02 / REQUEST · TRANSLATE · RETURN
Same track. A different interface.
185000 milliseconds and ok should become 185 seconds and playable = true.
Request ↓ · Response ↑ · Same track ID throughout
source.load("track-01")Expects a title, seconds and a playable boolean.load(id) → findTrack(id)Waiting for the library response before translating values.
No library response reached yet.
0 library calls · waiting for requestStart a trace to test your selected translation. Correct data alone does not prove an isolated client.
Each test uses a fresh local library. Back replays recorded evidence; it does not call the library again. No audio plays or external service runs. Changing a design choice clears verification.
See the code behind your design TypeScript
03 / EXTEND YOUR DESIGN
Another library wants to connect.
ArchiveAudio exposes fetch(id) and returns name, duration_seconds and can_play. Its values already use seconds and a boolean; its method and field names still do not fit TrackSource.
Connect it while keeping the same player. Which edits are needed?
First pass all three legacy-library cases with the same assembly.
Select the required edits, then start the final trace. Finish it to verify the new adapter.
Compare with a complete solution
No timer and no attempt limit. Try another assembly, use a hint, or reveal the answer when it helps.