Practice: Object Calisthenics + TDD + Advent of Code

Goal
Practice while doing advent of code exercises.
  • Object Calisthenics
  • TDD
  • refactoring



What is Object Calisthenics?



Why Object Calisthenics?
Code written in this style, should be
  • easier to change
  • easier to understand
  • easier to test
  • easier to reuse

This should cause code to be
  • adaptable / agile / maintainable



What is TDD
Red: write a failing test
Green: in the quickest way possible
Refactor:
  • cleanup code
  • cleanup tests

Refactor ideas

more:



Why TDD?
Writing code in this way, should result in
  • not over-engineered code
  • well-tested code
  • safe-to-refactor code



Why Advent of Code?
These exercises always come in 2 parts:
  1. initial assignment
  2. a new twist in requirements causing the need to change

I expect to be able to experience 'easier to change' in the second step.



Process
Start an AoC assignment part 1

TDD:
  • Red: write a failing test
  • Green: in the quickest way possible
  • Refactor:
    • Object Calisthenics compliant
    • (maybe) make the implementation broader by removing duplication

Finish part 1

Mini retro:
  • How did it feel?
  • What went well & should do more of?

Start part 2

TDD...

Finish part 2

Retro:
  • Were my expectations correct??
  • How did it feel?
  • What went well & should do more of?



Expectations
  • Object Calisthenics is sufficient for TDD's Refactor step. No other refactors are needed.
  • The change-over from part 1 to part 2 will be seamless, not breaking the flow of coding.




comments powered by Disqus