Uncle Bob, Lesson 4

tags: uncle-bob 

“Uncle Bob” is Robert Martin of CleanCoder. You may have heard of the Agile Alliance, Extreme Programming, and the SOLID principles. That’s “Uncle Bob”.

I’ve used and even taught Test Driven Development. I’m happy I did, but it shouldn’t be a religion. As with anything, take the ideas that work and leave the rest. Most of these sorts of debates center on people’s disagreements on how to optimize for their preferences and ideas, along with them dictating what your ideas and concerns should be.

Three laws of Test Driven Development

  • Programming is basically (see end of Lesson 1, Halting Problem and Correctness):
    • Sequence
    • Selection
    • Iteration
  • There’s nothing new in programming languages since Prolog.
  • New languages are old ideas repackaged.

  • Faithfully report impossible deadlines, and don’t commit to “just try”
  • If someone says “just try”, say “we are trying”

Three laws of Test Driven Development

  • You have to write the failing test first, then the code. (He said in Lesson 2 that the Mercury space program wrote tests in the morning and implemented in the afternoon).
  • You don’t write more of a test than you need for the next thing.
  • If you are really good in the debugger, you might be spending your time on the wrong thing.
  • Write the code in a way that you can test it
  • Testable code is decoupled code
  • Inheritance is the tightest coupling we get
  • Mutation tests (fuzz) - if tests survive a mutation, the tests are crap

  • Outside-In - lots of mocks and test doubles
  • Stateless - no mocks
  • London versus Chicago

But also

Also in this series