Who wants a sloppy workplace?
I’m not the kind of person who is easily annoyed, but there is one thing that gets into my skin – all the time. Inconsistently structured code. I hate arbitrary indentation, spacing and line breaks. It is close to impossible for me to assimilate a piece of sloppy code without first running it through a beautifier.
I ran into such a code again today, and for some reason I started to reflect upon my negative reactions. What is it about messy looking code that makes me dislike it so much? The first thing that came to my mind was this: The source code is where I spend most of my time at work, and who wants a sloppy workplace?
At second thought, that didn’t seem to hold – at least not for me. Here are a couple of pictures of my desk at work.
My computer corner at home is even worse. Clearly, I’m not a person who cares about a tidy workplace. So what’s the reason then? Why can’t I stand to look at sloppy code while I’m perfectly OK with turning my desk into a dump? Well, it beats me.
If you have an idea, please let me know.
Cheers!
Having a messy desk does not make you any less productive when the entirety of your work can be done on a computer. Your file system and code are more important to your productivity, thus you spend more time keeping those areas clean and organized as opposed to your desk (which simply provides a elevated platform for your computer and coffee mug). At least that’s what I tell myself every day to justify the state of my cubicle.
I guess you’re right, maybe I shouldn’t consider my real workplace my real workplace. Perhaps my virtual workplace is my real workplace? Wait, my head is spinning.
I don’t think of it as messiness, as much as cleanliness. Professional chefs “work clean” in the same way that professional programmers should be working clean – as soon as we open the door to dirty habits, then we limit our ability to quickly and safely deliver new meals/codes.
Hi Steve,
I think that’s a good analogy. It’s all about (good) habits.
One word came to mind from the pics: “surgical”. At my desk (all three of them :b ) I have a grand total of about a square foot (~ 0.1 m^2) clear surface area. As long as you can find the object you need it doesn’t matter what the storage space looks like.
I’d like to see a picture of that square foot and its surroundings 🙂
IMO, I am more distracted by sloppy looking code – it breaks the FLOW state. I am less disturbed by surroundings. Wwhen you work in a cubicle farm, you kind of tend to tune out noise, walkers, conversations etc. but your eyes are easily disturbed by the lack of harmony in code. Thinking happens best when you are looking at code, your mind constantly making new neural connections by the possibilities. Anything that disturbs that is bothersome.
Exactly! It breaks the flow.
I think part of the problem of seeing that kind of code is that you are not familiar with it. It takes some time to understand it and your fist perception of that difficulty is the wrong formatting. Then variable naming…etc. I guess we work like compilers: parse, compile and execute mentally.
Also we the programmers tend to dismiss code written by others and tend to be critical with it. This is not bad but those critics should not be expressed immediately.
What I am saying is not in favor of the sloppy code but maybe a reason the first perception is negative.
Insightful!
Bad, or more precisely, unfamiliar formatting is like noise around the message. Also, I think you’re right about our tendency to criticize eachothers code. That attitude can be good at times, but often hinder us to get to the core of the problem we’re working on.
I agree with you totally about code formatting. It really gets under my skin too and I believe it also undermines productivity when working with more than one person. If everyone works to an agreed house style, it is certainly easier for each member of the team to get to grips with the code.
We certainly have fairly stringent internal requirements at Revell Research Systems for our code layout and when I’ve lectured I’ve insisted my undergraduates adopt a house style (actually very similar to the one used in-house in the consultancy), which has always made marking much easier, if nothing else!
Your article also reminded me of mine on bannering, which you might like to take a look at (if you already haven’t!)