Clean Code


Learn code smells, IDE refactoring moves, and fall in love with continuously improving code quality.

After this workshop you will be able to:

  • Identify common Code Smells and compare various ways to fix them.
  • Refactor without introducing bugs, by splitting large changes in safe baby-steps.
  • Boost your productivity and focus by mastering your IDE refactoring support.
  • Become a better team player coding, reviewing, and pairing like a pro.
  • Learn state-of-the-art best practices of your programming language.


What to expect: The workshop mixes refactoring exercises with debates on design topics, attitude, ethics, teamwork, and more, in a very entertaining style, spiced with analogies and real-life stories. For a preview, check out my session at

Course contents


  • Introduction
    • Refactoring Opportunities: pre-done, boy-scout, pre-change, post-frustration, post-rush
    • Refactoring Stoppers: lack of time, fear, long branches, focus
    • Teamwork: code review, intentional-commits, pair programming
    • ⭐Baby-steps refactoring: how to split large changes in tiny steps
  • Expressive Code
    • Good names: explanatory variables, methods, and constants
    • Function signature: numbers of parameters, booleans (and default parameters)
    • Function depth and guard clauses
    • The 3 rules of a clean switch
    • Finding seams to break code in comments, empty lines, indentations
  • Clean OOP Code
    • Extracting Value Objects; Lack of abstractions
    • Encapsulation: push behavior next to State
    • Enforcing domain constraints; Micro-types
  • Clean FP Code
    • CQS Principle, Pure Functions & Immutable Objects; tradeoffs
    • Replacing loops (for) with FP pipelines (.map, .filter, ..)
    • FP patterns and anti-patterns: side-effects, stream wreck
    • [java] Optional<> best practices; null-safe data model
  • Refactoring Moves with IDE
    • Extract & Inline of variables, methods, parameters, constants and interfaces
    • Change Method Signature, Introduce Parameter Object, Move methods in data structures
  • Code Smells – the most damaging micro-design issues of today & ways to fix


Follow-up Refactoring Exercises (optional, after the workshop):

Yatzy (practice FP):

Gilded Rose (practice OOP):

Supermarket (practice modeling):

Target audience and prerequisites

This training is for you if:

  • You are a Java developer looking to upgrade the quality of the code you write.
  • You are a tech lead/coach/chapter concerned with growing these skills in your colleagues.


Prep work (mandatory):

  1. Coding: Refactor this exercise: (here as .zip), ideally working in pair/trio-programming, and send me the solutions for review before the training. The exercise should take around 3-5 hours.
  2. Clone and Import in your IDE the Workshop Code:
  3. Reading:
2 October 2024