20: Record your assumptions

I think recording our assumptions is hard. If it's an assumption, how do we know we're making it? I assume stuff all the time without consciously doing it.
I'm not sure we can effectively record our assumptions.

Often we'll make assumptions around values that are going to be static. Or technologies that "of course we'll be using that". These assumptions are potentially ingrained and unconscious - We can't record them in those conditions.
In Object Oriented Programming we want to encapsulate what varies. If we can recognize that an "expected" thing is something that COULD vary, that helps highlight that maybe it should be identified as an assumption. Being able to refactor that into a class/module enables us to record our assumption through extracting it into a type of that assumption. Less assumption, more... a single instance of.

Good OOP allows us to start to sniff out our assumptions and structure the code to enable us to be wrong without a costly change.

What's the book say... Unlike the last one; it's a big ol' blurb.

I'd say the book agrees. It goes into a story telling, but the end is "Isolate ... by encapsulating each assumption".

When we identify we've made an assumption; we should isolate it. If we find it after we wrote the code... isolate it.

This encapsulation can include a "WHY" comment describing the assumption and implications. It's also a single place that comment needs to be made.

Record your assumptions by isolating them.

Show Comments