journal for Practice: Object Calisthenics + TDD + Advent of Code


Things that are easy to procrastinate:

  • tests as documentation
  • package structure of code
  • package structure of tests (I keep nesting fixtures in one test class)
  • independent test fixtures

Do more of:

tests as documentation as early as possible

  • tell a story

test independent fixtures

  • Parsing as a separate fixture (and code more modular)

Wrap objects at Red-design


Try next:

create a todo list of stuff that needs to happen

  • I almost forgot that part 2 needed to extend part 1

copy tests from part 1 to part 2 if it makes sense for the story / comparison


test independent fixtures

I used to

  1. start with acceptance test
    • do a lot of design here
  2. keep that level of black box for the rest of the tests
  3. done
  4. refactor tests to be independant from each other

Now I tried

  1. start with acceptance test
    • do a lot of design here
  2. start TDD at a lower level
    • pick one of the points discovered in the design
  3. done
  4. (no need to refactor tests, already independent)

Parsing as a separate fixture (and code more modular)

I used to ignore parsing, leaving it in the constructor or static factory methods Now I started with the parsing. Now I have separate

  1. a module for parsing text input to domain objects
  2. a module for domain logic

The parsing module, is like an anti-corruption layer in DDD I feel much better that the parsing logic is not mingled everywhere

Previous days I’ve desired to move the parsing out, but decided not to, multiple times, because it was too big of an effort.

I also noticed that it’s more difficult to only parse what is needed, and leave it at that. I actually parsed the passport key and value in part 1, but never needed the value.