Skip to main content

Command Palette

Search for a command to run...

FizzBuzz and the Idea of a Coding Kata

Updated
4 min read

Have you heard of the term coding kata? It sounds a bit pretentious at first. Slightly martial-arts-adjacent. But the idea behind it is simple, and surprisingly useful.

This post covers three things:

  • what a coding kata actually is

  • what it’s good for

  • why FizzBuzz is often the first one people try


What is a coding kata?

A coding kata is a small, well-defined programming exercise that you repeat for practice.

The key word there is practice.

A kata isn’t about shipping features, solving novel problems, or showing how clever you are. It’s about working through a familiar problem so you can focus on how you write code rather than what the code does.

The concept is borrowed from martial arts: you repeat basic forms until they become second nature. In programming terms, that usually means:

  • naming things clearly

  • keeping logic simple

  • structuring code so it’s easy to change

  • noticing when you’re overcomplicating things

A good kata is intentionally boring. That’s the point.


What are coding katas good for?

Coding katas are useful precisely because the problem itself isn’t interesting.

When the requirements are small and fixed, your brain is free to pay attention to other things:

  • How readable is this solution?

  • Is the intent obvious without comments?

  • Would someone else understand this in six months?

  • How painful would this be to change?

They’re especially good for:

  • warming up before a coding session

  • practising TDD or BDD

  • comparing different styles or languages

  • interview preparation

  • team discussions about code quality

One underrated benefit: katas make trade-offs visible. When the problem is tiny, unnecessary abstraction stands out immediately. So does code that’s brittle or overly clever.


Why FizzBuzz?

FizzBuzz is a well-known coding kata. The rules are trivial:

  • count from 1 to 100

  • replace certain numbers with words based on divisibility

There’s no algorithmic challenge here. No data structures. No performance constraints. Which makes it a great first kata.

FizzBuzz forces you to confront basic questions:

  • How do I structure conditional logic?

  • In what order should rules be applied?

  • What does “clear” code actually look like?

  • Where does duplication start to creep in?

It also scales nicely. You can start with the simplest possible implementation, then later introduce new requirements to see how well your original design holds up.

That’s where it gets interesting.


The FizzBuzz kata requirements

For this kata, the goal isn’t to be clever or future-proof. It’s to write something that is correct, readable, and easy to change later.

Purpose

This kata is designed to assess how clearly and simply a solution can be implemented, with a focus on readability and correctness.
Additional requirements will be introduced later to test how maintainable and adaptable the initial solution is.

Basic Requirements

  1. Write a program that processes a sequence of integers starting from 1 up to 100.

  2. For each number in the sequence:

    • Output "Fizz" if the number is divisible by 3.

    • Output "Buzz" if the number is divisible by 5.

    • Output "FizzBuzz" if the number is divisible by both 3 and 5.

    • Otherwise, output the number itself.

  3. Preserve the order from 1 to 100.

  4. Output each result on its own line (or clearly separated, depending on the language).

Constraints

  • Assume valid input.

  • No performance optimisations required.

  • No UI or error handling.

  • No extra rules beyond what’s listed.

Notes

  • Don’t design for future requirements.

  • Don’t guess what comes next.

  • Build for today, but build it cleanly.


Why this works as a first kata

FizzBuzz is small enough that you can finish it quickly. That’s important. A kata should feel safe to restart, rewrite, or throw away.

At the same time, it’s rich enough to expose habits:

  • Do you reach for abstractions too early?

  • Do you lean on clever tricks instead of clarity?

  • Do you write code that invites change or resists it?

If you’re new to katas, FizzBuzz is a great place to start. If you’re experienced, it’s still a useful mirror. The problem never changes, but your approach probably will.

And that’s kind of the point.