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

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

Studio Assistant

Ask about Hugo’s work

Answers come from Hugo’s published studio facts and CV via Cloudflare Workers AI. Hugo reads the questions to improve how the site explains his work, so that one day you will not need to ask. Questions and answers are kept for 12 months, without your name or IP address, so please leave personal details out.