tidy first from a crafter

Abstract

The speaker is talking about the new book from Kent Beck: tidy first. The book is split in:

  1. tidying (patterns)
  2. managing (tactical)
  3. theory (strategic)

It promotes baby steps, boy scout rule as a mindset, micro-refactoring, low-priced, code hygiene enforcer, …

Strategy

Products are split in behaviors and structures. Code is about changing the structure. structure affects behaviors, so if it’s not well done, it will heavily impact on how we can update behavior.

We also need reversibility: behavior can be difficult to reverse because it has its own history, impact users, … whereas it’s way more easier to reverse the structure.

Instead of talking about technical debt, we should talk about optionality in software:

  • software design = preparation for change (of behavior)
  • behavior change (tomorrow) = option underlying (e.g. DDD)
  • structure change (today) = option premium

Constantine’s equivalence: cost of software ~= cost of change ~= coupling. Talking about “Optionality” instead of technical debt to non-tech people is easier. It gives positive energy, compared to technical debt.

Tidying patterns

Presentation and readability

  • chunk statements
  • normalize symmetries
  • dead code
  • reading order

Design improvement

  • guard clause
  • extract helper
  • one pile (inline)
  • new interface, old implementation

Knowledge and documentation

  • explaining
  • variables/explaining constants
  • explaining comments
  • delete redundant comments

Cohesion enhancement

  • cohesion order
  • move declaration and initialization together
  • explicit parameters

Reviews

2024-07-17

Really nice summary with a small demo on how to apply the tactical tidying. This presentation made me want to read this book tidy first along with refactoring.