Back to all work

TDD Kata / algorithm & visual time encoding

Berlin Clock (Mengenlehreclock)

A precision implementation of the Berlin Clock (Mengenlehreclock) in Swift built with strict Test-Driven Development (TDD) and illuminated colored time blocks.

100% Test CoverageGitHub Open SourceStrict TDD
  • TDD
  • Swift
  • Algorithm
  • Unit Testing
  • Visual Encoding
Berlin Clock running on iPhone with hours and minutes blocks
Berlin Clock state showing midnight 00:00:00 visual encoding
Berlin Clock ticking in real time with illuminated blocks

Real-time Berlin Clock time encoding algorithm in action

Methodology 100% Strict TDD
Coverage 100% Code Coverage
Encoding Yellow / Red / Off

What the project needed.

The Berlin Clock tells time using illuminated colored blocks read top-to-bottom: 1-second blinking yellow lamp, five-hour red blocks, single-hour red blocks, five-minute red/yellow blocks, and single-minute yellow blocks.

What I shipped.

  • Implemented the complete Mengenlehreclock time-encoding algorithm using Red-Green-Refactor TDD.
  • Separated string-based time representations (Y/R/O) from rendering logic for flawless testability.
  • Created a smooth visual interface mapping string states into animated illuminated colored blocks.

Technical architecture & leadership.

  • Authored the mathematical test suite and decoupled the presentation layer from the clock domain logic.

Results in production.

  • Clean reference example of applying TDD to algorithmic and visual state problems in Swift.

Have a similar challenge?

Whether you are architecting a new Apple product, optimizing video/AVFoundation pipelines, or enforcing strict TDD, tell me what needs to be solved.

Discuss your project