Rule #5 - Code for the Maintainer
By
Steve on
Thursday, February 07, 2013
Updated
Friday, April 22, 2016
Viewed
23,425 times. (
0 times today.)
Everything can change in an instant.
One minute, you are in the prime of your life. The next, you glance over your shoulder
and unknowingly glide into an intersection where a truck T-bones your car. Or maybe
it's the moment an armed thief enters your subway car. He demands your valuables,
but you say no. All you see next is a bright flash of light.
Everything can change in an instant.
For me, that instant came in 1973 in Mr. Hoover's kindergarten gym class. It would
be a moment that changed the course of my life. A moment after which nothing was
ever the same. It was the day my whole outlook on life changed. It was the day
I became a rebel.
I was four years old. The students were all loud and raucous as four and five year
olds tend to be. Mr. Hoover, though short in stature, towered over us as he blew
his gym whistle to get our attention.
He informed us in a mock military style voice that we would be running relays. He
continued speaking, but no one could hear him because all of the children squealed
their exuberance. Perturbed, he blew his whistle again.
"Count off in sixes," he yelled. "We'll have six relay teams."
So we all counted, beginning at one end of the line and proceeding to the other.
He then commanded us to break into our six teams forming perfect little lines of
about six children each. In the chaos, I became disoriented and was one of the last
kids standing before I found my team and slunked into the last position.
Mr. Hoover, as he was want to do, mixed things up by ordering all lines to reverse
order. I did not understand his reasoning, but the other children were quick to
groan and mumble as the first became last. I, as the last, was now first in line.
My anxiety began to mount. Being first was a position of responsibility. I would
be the first to act and I knew I had to follow instructions precisely or I would
be humiliated.
In my mind's eye, I imagined Mr. Hoover blowing his whistle. I then imagined myself
jumping forth doing the crab crawl with all of my little might. And then suddenly
realizing I had mis-heard. Perhaps Mr. Hoover had said begin on the second whistle.
I could imagine all the other kids pointing and laughing at my humiliation.
I did not want the first position. I did not want this responsibility.
And yet I had it.
Mr. Hoover explained that for our next relay we would each bunny hop to the other
end of the gymnasium and then run back to our team. Once we tagged the next runner
he or she would do the same. At least, that is what I thought I heard. Hearing
was difficult over the din of excited toddlers.
And so he began.
"Ready," he raised his hand. "Set," he put the whistle in his mouth. I looked left.
Then right. The children all toed the line, bouncing up and down in slow motion,
eager to mow me down and prove my slowness. Their arms were cocked like shotguns
ready to explode.
And I was confused. Didn't Mr. Hoover say we should bunny hop first? And then run
back?
Each of the children next to me looked poised to run all out. Not one was standing
like me, with both feet together ready to hop-hop-hop his way down the gym floor?
What was going on?
The panic welled up in me. My worst fear realized.
Every other team was ready to run. They all seemed so sure of themselves. Cheering
their teammates on. They all knew exactly what they were supposed to do.
And the whistle blew.
The other kids took off like rockets, running as fast as they could go. All the
team members were yelling and cheering.
I hopped.
And then I hopped again.
The other children were gone in a flash. My team yelled at me.
"No! Steve! Run!"
I thought I must be wrong. The temptation to abandon my hop-hop-hopping was overwhelming.
I lagged far behind the others.
Yet, in spite of my growing embarrassment, a voice in the back of my head said, "No, Steve. You
heard him. Bunny hop down, run back."
And so I hopped again, and again, going as fast as I could. Soon, the other kids
turned and started back. Eventually I reached the other side of the gym and turned
also. But now, I started running. I passed a few kids who were now hop-hop-hopping,
but I felt more wrong by the second. I jogged into the finish where I tagged my
teammate who took off running like all the other kids.
My team were quick to inform me that I did it all wrong--as if somehow I hadn't noticed.
I hung my head as I sat cross-legged among my teammates and hoped no one would notice
me.
Eventually, all six kids on my team finished and the relay was over. Some cheered,
others protested, but I heard none of it. I just wanted to fade into the wood floor
and forget myself. But it couldn't be so simple.
Mr. Hoover slowly moved to stand in front of us. His arms crossed while he gazed
at the floor. He waited saying nothing. My fellow students seemed to detect, one
by one, that something was wrong and quieted themselves. Eventually all I could
hear was breathing and Mr. Hoover looked up.
Gulp. My heart raced.
"One person," he began. His eyes darkened with anger. Oh no, here it comes.
"Only one person did what I told you to do!"
"Only one person bothered to listen to what I said. And only one person had the
guts to do what I asked even when all the rest of you brats went running off like
chickens with your heads cut off. That one person is Steve."
He pointed at me and started clapping. The rest of the class, though a bit confused,
joined in. He stared at me and continued clapping. His eyes didn't waver. I wanted
to hide or break his gaze, but I couldn't. The shock of being praised instead of
scolded was overwhelming. And they were still clapping. They only stopped long after
I thought I would die of embarrassment.
Mr. Hoover continued to lecture the class for another ten minutes about honor and
dignity, about paying attention and behaving like grown ups. I'm sure it fell mostly
on deaf ears. I heard little of it myself, still overwhelmed by the whole situation.
In time, the confusion and fear of that moment faded while the pride in myself continued
to grow. I would come to see Mr. Hoover's intensity in that moment as something
more fitting for an injured war hero returning home from the battlefield than for
a four year old doing the bunny hop. But somehow, in his mind, they were the same.
Do you suppose a war hero feels confident and deserving of his medals? Or does he
recall only the terror of the moment, the impulse to act in a single brief moment.
Does he wonder if he could have just as easily run away as risk his life to save
another? Maybe.
I now know what Mr. Hoover saw in me that day. It was courage. The courage to do
what I believed was right even when everyone else was doing something different.
It Works on My Machine
There is a class of developers who are a lot like my kindergarten classmates. They
are largely focused on themselves and what they want only. These developers say things
like, "It works on my machine." and "Why would you care about that, just use this
thing I downloaded from the web."
They are not interested in understanding what they are doing and don't bother to
think much about the consequences of their choices. And if you have been doing software
very long, you know choices have consequences. Consequences in the billions of
dollars sometimes.
They are enthralled by the joy of doing something fun or playing with the next cool
technology, but they are careless and think only of what happens on their own desktop.
When the whistle blows, they just start running.
I'm not saying they are bad people. What I am saying is that if you want to be a
good developer and a valued employee, you cannot afford to think the way they do.
No matter how much you love writing software--and I do love it--writing software
can be hard work. It's not for the faint of heart.
The very fact that you are still reading this article suggests to me you are not
one of these developers. Or at the least, don't want to be one.
An Ounce of Courage
If you have the courage and the desire to be a good or even great developer, you
will have to pay attention to something outside of yourself. You will have to block
out the voices of the masses, and you will have to think for yourself about what
makes a software project successful. You will have to look at the big picture.
And in the big picture, software maintenance is often much more costly than the original
development. We know from many sources that the better the original development
is, the cheaper and easier the maintenance.
In fact, I've been on several projects where the original code was so unintelligible
that maintenance essentially amounted to rewriting the software.
I mentioned at the beginning of this article that I became a rebel that day in kindergarten.
Only I didn't become a rebel of the James Dean variety, A Rebel Without A Cause
. I became a rebel with a cause. What is a rebel after all, but someone who goes
against the flow, who doesn't do what everyone expects him to do. You could be a
rebel by defying authority and ultimately hurting yourself. Or you can be a rebel
by making the greater truth your master rather than just your boss or your own selfish
impulses. In this way, you bring much greater value to yourself, to humanity and
to your software team.
One of the greater truths when writing software is that it doesn't matter if it works
on your machine, it only matters if it works on the customer's machine. That should
be your primary concern. Another truth is that you bring more value by taking the
time to write clear, simple, well documented code even though it takes twice as long.
It takes courage to do a job right, especially when bosses or management types are
putting on the pressure to get the job done.
"I Bid You Hold"
In the Shakespeare play King Lear, the king is acting irrationally and decides
to run a man through with his sword. The king's servant sees this and says, "No better
service do I give you now than to bid you hold." The king turns toward the servant and
in his anger kills the servant. Though it didn't end well for the servant he did tell
the king the truth. The servant knew he was risking his life, but he warned the king
anyway. Isn't this the highest kind of service?
As a developer you can have a great impact on your team leads and business leaders.
Have the courage to speak up for good software practices and for the time to do some
refactoring when necessary. This may take courage, especially with certain bosses,
but it is the right thing to do. Your boss may even fire you as King Lear "fired"
his servant. But lucky for you, it's not your life on the line. Skilled software
developers are in demand and if your current boss can't appreciate a little feedback,
politely spoken, you'll be happier somewhere else anyway.
You can live a life of mediocrity and going with the flow. Or you can take a stand
for truth and lead a life of adventure, dignity and excellence. The risks are only
slightly greater and the rewards are much greater.
Conclusion
In this article, I have suggested that it takes courage to look at the big picture
of software and to think about things beyond your own desktop. By
"coding for the maintainer" you dramatically decrease costs and increase the
long term success of a software project. Wouldn't you prefer to leave a trail
of successful projects in the wake of your career? Then write your code as
cleanly and simply as possible. This is more work than just writing code, but
it's worth it...and you will make Mr. Hoover proud.