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. During the last half we will refactor some larger samples, ideally anonymized from the audience’ production code. To get a sample, 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
    • Exceptions Best Practices
  • 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, Try, Tuple4, 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
  • Larger Refactoring Exercises (2-4 hours):
    • Victor on 1-2 snippets of Production Code from the audience, and/or
    • Participants on a Refactoring Kata in Pairing or Mobbing
  • Any Other Debates, guided by the audience questions


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/Kotlin/Scala/PHP/C# 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:


  1. [optional] Send me a code sample to refactor together during our session, if you believe we can have some fun on that. Here are some instructions on how to select it:

– a snippet/a class of ≤ 100-300 lines from your project.

– The ideal sample exhibits some typical issues in your project’s codebase, perhaps debated at code reviews.

The focus is on learning: don’t select THE most complex part of your code, nor the most trivial.

– Please try to make the sample compile, to save me some time (optional).

– Please anonymize the code: e.g., rename ‘Account’ to ‘Basket’, ‘Transfer’ to ‘Apple’, etc..

– I can’t promise we will refactor all samples you send me – I will select 2/3 of them.



 - 21 May 2024