Practice ยท 3 of 3
Report Service with a Seamed Clock
Combine Module 8's seams with Module 12's layering in Solution:
- interface Clock { long nowMillis(); } (reuse the shape)
- static class ReportService with constructor (Clock clock) exposing
String header() returning "Report @ <millis>" using the injected
clock.
- static class ReportController with constructor (ReportService s)
exposing String render() returning s.header() + "\n[body]".
Build the graph twice with different clocks โ proving the controller is
agnostic to time. This is the composition root skill.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Architecture Lab