Why do you clean up the office?

January 31, 2022

Refactoring is much like cleaning up the office. It gives developers an organized and clean workplace so that they can feel good while doing meaningful and productive work.


Let's try a thought experiment: imagine nobody will clean your office for the next two weeks. Apart from the little actions you do every day, like throwing the trash in the trash bin or bringing some of the coffee mugs to the sink, there's nothing else. What would happen? My somewhat limited imagination foresees the following:

To begin with, very soon you will start running out of coffee mugs. You cannot get your morning coffee anymore (you can't even make it because the coffee machine is dirty), and that slows you down. Not only you, but your entire team. Nobody is that awake anymore for the three-hour spring planning meeting, and the output is only half as good as when everyone is hooked on caffeine.

Then you have to go to the restroom. As soon as you go through the door, the smell goes through your nose. You hold your breath as best as you can, but it's taking longer than expected, and your brain needs oxygen. So you let the air in. That puts you in such a bad mood. Not only you, but your entire team. There is no freshness in the office anymore, and the smell seems to follow you even hours after you left the toilet.

Your table starts to become smaller because of so many things on it. It's hard to navigate around and find what you need. You had a system before, but because there is no one there to clean up, things are just getting messier and messier as the hours pass. You try to solve your problem by moving stuff around, and so does everybody else. So you end up with the common shelves being flooded with myriads of unrelated stuff, and nobody can find anything anymore.

Then the trash gets full. The trash next to your desk and next to everyone else's. You apply some pressure to find some additional space, but eventually, trash starts spreading across the floor. Your desk is a mess, the floor is a mess, the office smells bad, everyone has a headache and other caffeine abstinence symptoms, it's chaos.

Finally the day is over. You pack your stuff, your mind already outside enjoying the freedom. But, well, as you go through the door and look back, you see the mess that is waiting for you tomorrow, and you say to yourself silently "I wish I didn't have to come back..."


If you are a developer, perhaps you see the parallels with a messy codebase. If you are not a developer, hopefully this gave you some insight into how important it is to have an organized workplace. It's not something we notice every day when we enter the office, but it's something that clearly throws us out of balance when it's not there.

Code is the workplace of the developer, and keeping it clean is not only recommendable, but crucial for healthy, engaging, and sustainable work. Cleaning code has a name: it's called refactoring. Refactoring is not about fixing bugs. Fixing bugs is about fixing bugs. Fixing bugs changes the observable behavior of the system, so it is, by definition, not refactoring. I can't really express it better than Martin Fowler did in his Refactoring book:

[Refactoring is] a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.

So there's the intent. There has to be an intent, otherwise refactoring is like moving the bunch of clothes from the bed to the chair and then back to the bed without really organizing anything.

You don't need to justify cleaning the office to your higher management. They won't come to you and say "look, cut time on that cleaning, you need to deliver more!" There is no direct trade-off between the two, except if you spend the better part of your day moving stuff around without a clear purpose, or "overcleaning" what is already clean.

Refactoring is much like cleaning the office. It's mostly made of little actions. You and everyone else take your coffee mugs and put them in the dishwasher. Another person turns the machine on. Someone else organizes it when it's finished. Everyone keeps their desks and shelves organized. If you spill some water over when washing your hands, you quickly dry it up so it doesn't become a mess. Small things, done often, done by everyone.


Profile picture

Lauro Müller has been transforming the IT departments of multiple companies for several years. His areas of expertise include software product management, cloud computing and migration, building effective teams, infrastructure management, and full-stack development. Schedule a free discovery call to discuss your project.

© 2024, Built with love (and Gatsby)