The "Hotel Room Rule"

<Thoughts about Clean Code Development>
As a  Clean Code Developer we should follow the "Boy Scout Rule", that says: "Check-in our code a little cleaner than when we checked it out".

Additionally to the "Boy Scout Rule", Uncle Bob spoke about Sushi chefs, that clean up their work as they go and do their work. 
I call this the "Sushi Chef rule: Clean up as you do".

image
Figure: Sushi Chef Rule: "Clean up as you do"

The problem with that in my eyes is, that this "rule" is not applicable in Software development.
As a developer we want to get the job done as quickly as possible. "Hacking away / getting something" done and "cleaning up" are 2 different modes on how we work and think. Switching between these 2 modes is not easy, because its almost a context switch, and switching contexts is bad. I actually tempt to think: "I fix that up later" and add a couple of "TODO" as I hack away…
Additionally when we want to get something done, we need to "get into the zone". This "zone mode" is different to the cleaning up mode, where we browse and read code.

 

I thought about this and the "Broken window theory" a little bit more and found another analogy: Hotels.
If you stay in a hotel for a week, there is some cleaning personnel that clean your room every day.

  • Why are they cleaning the room every day?
  • Why they are not just cleaning the room when I leave the hotel at the end of my holiday?

The reason is the "Broken window theory". A little mess attracts more mess, and gets a big pile of mess over time.
That lead me to the "Hotel room rule"

image
Figure: Hotel Room Rule: "Let someone else clean up your code every day"

What do you think?

  • Can we apply this principle to software?
  • Wouldn't it be nice to have someone else to clean up our mess for us?
  • Please give me an army of software cleaners that "clean" code for me?
  • Will there be a university degree or specialization in the year 2035: "Master of Software Refactoring and Code Cleaning"?

Latest Posts

Popular Posts

 
Google Analytics Alternative