tidy first from a crafter
src: 'Tidy First?' de Kent Beck - Arnaud Thiéfaine - Alpescraft - 2024-06-26
Abstract
The speaker is talking about the new book from Kent Beck: tidy first. The book is split in:
- tidying (patterns)
- managing (tactical)
- 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
andstructures
. Code is about changing thestructure
.structure
affectsbehaviors
, so if it’s not well done, it will heavily impact on how we can updatebehavior
.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 thestructure
.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
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.