|Source: Abu Badali, CC 2.5, via wikimedia|
In 1964, for thirty-five long minutes, thirty-eight citizens of a respectable Queens neighborhood watched as a twenty-eight year old woman named Kitty Genovese was brutally raped and murdered. Not one person phoned for help.
The Bystander Effect
This story illustrates an unfortunate property of 'The Bystander Effect': The probability that somebody will render assistance decreases as the number of people increases.
As software engineers, we see the bystander effect in action every day. If your codebase is of any reasonable size and age, you are likely to have problems such as lack of encapsulation/separation of concerns, complex (or just plain wrong) class hierarchies, methods that are so long that they read like a chapter in the latest Stephen King novel, untested code, broken tests — and nobody does anything about it.
The root of the issue is lack of ownership. We assume that somebody else will fix the problem. In the case of our codebase, we may be apathetic because "it's not my mess". That's the problem with us software engineers: we don't want to fix problems caused by other engineers. The attitude of "it's not my mess" prevails.
Oh, but is it ever your mess.
Economists speak of something called 'Externalities'. That's a fancy way of saying that person A gets the benefits of something and person B pays for some or all of the cost. As person B, you will eventually need to modify that horrible class that person A wrote. You'll wish it were better designed. You'll wish you had functioning tests. You'll end up doing more work just to make a simple change. Your boss will wonder why you can't perform a simple task in a timely manner. You pay the cost for somebody else's poor decisions — that's a negative externality.
A Culture of Ownership
Fixing the side-effects of negative externalities is simple: take ownership of the problem — whether you caused it or not. Who cares about who is responsible? Those people are likely long gone anyway. Still waiting for them to fix it? It's not going to happen. Assume that nobody except for you is going to make things better.
Once you do that, a culture of ownership starts to emerge. When those tests that you worked so hard to fix end up breaking, you're on top of whomever broke it because you have sweat equity.
Likewise, you start to get improvements in your codebase 'for free'. You open up a piece of code that previously had issues. You dread working inside of it. Your sense of dread soon turns to delight as you find that some kind soul has made the world a better place. All of this happens because somebody else felt a sense of responsibility. That's a wonderful thing.
So how about it? Spend a day this upcoming week in a section of code that is like taking a tour of the wrong side of town. Commit a random act of coding and leave a comment:
/* JKH 09/12/2012 - Refactored poorly managed transactions. If this makes you happy, PAY IT FORWARD! */