Friday, December 16, 2005

The Codewright and the Code Monkey

How To Tell the Difference Between the Code Monkey and the Codewright.

One day I was thinking, excuse my French, about what made a good developer. There have been many labels used to describe various coders, the cowboy, the prima donna, etc. I wanted to focus on both ends of the spectrum. I feel like the contrast is instructive. I've found myself coming back to two terms in particular. The Codewright and the Code Monkey. The Codewright is a cross between an architect and a shipwright; the designer and master craftsman put together. The Code Monkey comes from the image of an group of monkeys, either in a zoo or in the wild, being terrorized by a single individual who gets away with it by being louder and more obnoxious than the rest.

The Code Monkey makes a lot of noise, because they need everyone around to know they are there without inviting closer attention; looks really active with lots of arm flailing, because this looks very similiar to productive work but is much easier; gorges themselves on the best resources (bananas) in reach, because they deserve it since they doing so much work; produces prodigious amounts of excrement, because they operate under the assumption that quantity is better than quality; and is blissfully unaware of the effect they have on others, because they don't stick around to see the results of their efforts. Here is a site that has collected plenty of evidence for the existence of the oft-sighted, rarely-tamed Code Monkey

The Codewright makes little noise, because he's thinking about how to solve the problem; moves slowly when he moves at all, because he's measuring twice and cutting once; is a resource in and of themselves, because they freely dispense wisdom to those patient enough to listen; produce works of such utility and craftmanship that they are still in use decades after their creation; and is acutely aware of the success of their work, because they know that producing poor quality work is as foolish as poisoning the well from which you get your drinking water.

So, are you a Code Monkey or are you a Codewright?

p.s. I noticed a good article that talks about the effect of people on the development process itself.
Delicious Bookmark this on Delicious

Wednesday, November 02, 2005

The Scars We Bear

Wow, you're still here! When my key still let me into the building, I chalked it up to lazy management. I figure pretty soon I'll show up and be locked out.

I was watching an old war movie, and it kept reminding me of software development. If that sounds sad, I'll leave it to you to decide which is sadder, that old worn-out war cliches can be applied just about anywhere or that there is someone willing to stretch them even farther.

You are in the mountains on a poorly-maintained dirt road leading up to a large encampment; an extremely busy tent city that looks as worse for the wear as the road you're on. People are all running everywhere, yelling to anyone who'll listen. Ok, ok, if you've ever watched M.A.S.H. you get the picture.

Sitting serenely at the edge of the camp is a sign that simply states "Hospital". Some jokester has added a hand-written sign to one side that reads, "Surgery while-you-wait, anesthesia extra, hack jobs our specialty." The tinny-sounding PA system is playing a familiar tune, occasionally interrupted by various announcements like, "Tonights movie is Godzilla vs. Gumby." When you are able to make out the song, the lyrics go something like this:

[M.A.S.H. Theme]
Source control is painless
It takes on all your changes

and I can take or leave it if I please.

Enough of that. I'll skip ahead to the juicy bits. You're looking over the shoulder of someone wielding a bloody bone-saw, a surgeon you hope, hurriedly working on a prone patient.

"Dr, is it bad?", says a guy that looks like the patients commanding officer.
"Of course it's bad! Just look at all that scar tissue! How many times have we worked on this guy?", says the guy with the saw.
"This is the second time this month. How much longer do we have?"
"The patch job from last time is all messed up. Once I stop the bleeding we can fix that broken leg."
"We don't have time for that! We'll just send him back to the front with a splint and some crutches; his buddies can support him until this crisis passes."
"If you say so. I can patch 'em up again but it'll be temporary even in the best case. "
"That's ok doc, we'll lose the battle if we don't."

The guy with the saw turns around; you are taken aback. When you go to look at him, you find yourself looking at yourself! Oh, ok. Maybe that was a little on the dramatic side. You thought we were here to talk software, not surgery. Was that a Twilight Zone moment or would you prefer The Empire Strikes Back?.

And now back to our code. Did I forget to mention the Hospital sign says at the bottom, "Supporting your Software Maintenance Needs"? Didn't you know that a keyboard is like a scalpel? You can amputate, graft, transplant or even give a facelift. I heard that! What about boob jobs? I'm not against giving jobs to boobs but aren't there enough of them working as programmers already? *bah-dum-dum!*

So, what's the problem? The problem is scarred code; regardless of platform, language, or even political affiliation. Clogging your source, like lumps under the skin with their fibrous tendrils choking the life out your methods and making your classes uncouth.

Here is one of the simplest examples of scar tissue.

// Date begin1099year;
Date year;

An old variable that has been left in a comment to rot. I'm not talking about the times when you comment something out while deciding on a solution, maybe while debugging. I'm talking about code that has been checked into source control, scar intact. You've all seen it, whole methods commented out; line after line, like a vast wasteland.

"I'd like to clean this up but I don't have time!" we tell ourselves. "We'll come back later and fix it" should rate right up there with "The check is in the mail" and "I'm from the government and I'm here to help". "I need to be consistent even though I don't like the stuff that is in there", we say to soothe our conscience as we add to the problem. "It's already so scarred that one more won't hurt". In other words, yes it is a tumor but it is benign. So like Alfred E. Newman likes to say, "What? Me worry?" So slowly, without outcry, a pattern is established. If enough scarring is allowed to collect and that pattern, like history, repeats itself -- with apologies to Mr. Simon -- silently the scars, like a cancer, grows until they are everywhere, metastasizing even into the code of other applications.

Why do we still see commented-out code from years ago still in the source file? Why do we still come across programs that look like they are the hastily put-together compiler-spawn of the developer equivalent of Dr. Frankenstein? I have to watch out when I ask those questions, I end up trying to understand the mind of a code monkey and I wouldn't want any of their habits to rub off on me.

If you could bring these code monkeys to justice, what would be an appropriate punishment? If you let your imagination loose, you might come up with the following. Force them to sit in a brightly lit room and watch a computer screen, with no glare-guard, scroll through badly formed HTML pages overloaded with <blink> tags and cute "Under Construction" signs while listening to The Hamster Dance? Oops, we might have overdone it, the evil giggling from the section in the corner is starting to creep me out.

Indeed, let's keep the brightly lit room and the glaring screen and give them the standard third-degree. When interrogated, the code monkey might tell you, "But I might need that later!" Do they think it might go missing if they don't keep it around? Reminds me of the old couple that keeps stacks and stacks of every newspaper they ever received 'just in case we need it later'.

How about, "I'm not sure if it needs to be deleted yet!" The Code Police might let you off with a warning but you better be debugging. Comments are not like fiber for a compiler you know, more won't keep it healthy.

"I don't want to check in my code yet, it isn't finished!", which is a whopper. Are they hoarding code? Do they think they are working on the next Mona Lisa? Can you imagine what would happen if that happened in construction? The carpenters show up to put up the walls and the guys pouring the foundation say, "You can't see the foundation yet, it isn't dry." Without seeing the foundation, how can the carpenters plan when to start adding onto the foundation, not to mention checking to see if the foundation matches the blueprints?

"The stuff I write is so good, surely somebody will need it later!" Is that raw, unfiltered arrogance I smell? I have news for them. I have a use for it right now, as digital litter lining the cyber cat-box for my virtual feline. Too bad I don't have one, guess I'll just throw all the scar tissue code in the bit-bucket. Check for more programming jargon.
Back to the code. I was thinking the other day (don't say I didn't warn you about that) when you are working on code, do you feel like you are in a war zone, elbow deep in the digital entrails of some hapless script and a hack job is all you feel you have time for while working on your current program? Or do you take the approach that you are a highly-paid neurosurgeon who uses the latest in technology to perform miracles with the slightest of incisions upon the executable that is your patient?

I'll let you think on that. Good night and thanks for all the fish.

[The lights go out]
Hey! I thought I put plenty of time in that meter. Cheapskate landlord. Ah, here it is. Let me put in another quarter.

[Click! Music starts to play.]
I found the jukebox!

[From backstage you hear]

Hello darkness, my old friend.
I've come to talk with you again...

Delicious Bookmark this on Delicious

Wednesday, September 07, 2005

To Function or Not to Function, That is the Question

What is the difference between a functional and non-functional requirement?

If a requirement uses a verb to describe the feature then it is functional; What will the system *do*? If a requirement uses an adverb or adjective to describe the feature, 'how' will it do whatever, then it is non-functional.

I've almost always been interested in the importance of language in discussing requirements. There are two ways to listen to your customer, literally and figuratively. That the customer has difficulty describing their requirements has been a problem in the software field for so long that it's now a cliche. What some analysts have done in to start reading between the lines to capture what the customer is "really" saying. There can be some benefit to this figurative approach but I would always to to listen to them literally. In many cases this meant inconsistent or confusing descriptions, the key was to realize that those questionable points were just that, points to question. In getting clarification about those requirements, we can get a more detailed understanding of the problem domain. If their choice of words or phrases contradict, ask them about it.

Sometimes we need to listen figuratively or "between the lines" to get the overall picture but listening literally can be indispensable for uncovering the things you need to dig into for more details.
Delicious Bookmark this on Delicious

Sunday, September 04, 2005

In the beginning...

Hello out there. You know, this is an awfully large place we've got here. If you won't mind the echo, I'll overlook the lack of applause. When I shield my eyes from the bright glare of the spotlight I can just make out a few people sitting in the back row wondering what all the fuss is about. If you've come here for a show, you're in the wrong space, Streisand is already gone so you'll have to make due with Celine a few doors down and to the left.

To be honest, I haven't really gotten over the idea that a blog is narcissistic. That's why I never bothered with a personal web page. Hey look at me, I can write markup tags! Aren't I special? Just a modern equivalent to those old home movies people used to bore their neighbors.

I know what you're thinking, "Well, what am I doing up here then?" Well, a good friend of mine has been asking me when I was going to start a blog. Even though my spare time is scarce, I try to get away from my desk during lunch when I can. Some of these times I head over to talk with him, to discuss one thing or another; to rehash old news, talk about current events or even bring up new ideas. It would seem that this might be a good time to clear the air and confess that I have a disturbing and most shameful secret. It's not one that gets you shunned at parties, makes small children stare or otherwise cause calamities with which only country music can compare but it is something that can be rude, in polite company, to share. What is this nasty, dirty little habit of mine?


Wow, I wouldn't have thought so few people could produce so much laughter! Either that or the crowd is growing. I'll chalk it up to the crowd anticipating a NASCAR moment. They don't mind watching something going 'round in circles as long as they get to watch the crash. Hey, you with the Celine shirt and designer shoes, you're in the wrong place. You want the one that's two sites down and a page to the left.

So, is thinking really a bad habit and what does that have to do with this blog anyway? It's like this. I'm addicted to thinking. I have to have my daily 'fix'; can't go very long without it. Doesn't have to be anything special like 'Why are we here?' or 'Is there a God? And if so what is her name?' (Ha! Caught you!) but can be more down to earth like 'Why do people who drive SUV's complain about the price of gas?' I'd go on but seeing as 'why' is a four-letter-word I'll refrain from such talk in mixed company. That's right, I'm counting the waitress. Ask me about 'why' later; if I'm in a good mood I might give you an earful. Who am I kidding, I'll give you an earful about anything, just keep the drinks coming. Pepsi on the rocks and don't bother putting the cap back on the ol' 2-liter.

Where were we? Oh, that's right, the blog. I guess if I'm going to think, I might as well have a place to keep my thoughts. That way I can nurse along the ones that aren't ready for the light of day and give you a peek at the ones in which I have pounded out the kinks even if they are nothing more than my opinion. Yeah, yeah, I've heard that one before, "Everyone's got one and it stinks." I didn't say I'd put all my dirty laundry out. Yes, I could keep them to myself and yes I've tried using a tape recorder. Listening to myself is such a chore. Did I say that? I didn't mean it, come back! If I'm going to type up my thoughts, I might as well have a single place for them. This way if I discover a gem in the rough, I can get help to hone and polish it and only share it when it glitters in the reflected light of reflective thought. But some thoughts are stronger than that, more malleable and can withstand the forge of public opinion. One of those I can share with the public and use them to pound it into shape and quench the fire until what is left is tempered and ready to be sharpened to a degree that would make old man Occam proud.

What's that? Yes, you in the back row, speak up. You'll have to excuse me, 'My Heart Goes On' is getting louder. What am I going to write about? Oh that's easy. I'll spare you the long list and give you the highlights. Hmm, let's see. There is code 'scar tissue', and bad smells, how to tell the difference between a Code Wright and a Code Monkey; how about the importance of Design, using patterns and identifying anti-patterns, the pitfalls to code reviews both new code and maintained code, the questions to ask that can help to keep you from doing design during analysis. Not only that, if I hear any news from the 'Extreme Programming' front, I'll pass it along to those developers next-of-kin.

Am I boring you yet? I did warn you. I better stop there, I only have the place for the hour and the manager keeps telling me he'll kick me to the curb as soon as he finds a better act to fill my slot. I'll just take a quick break from juggling all these thoughts, don't want too many hot ones out at the same time, I didn't wear my asbestos undies today.

Good night and thanks for all the fish.
Delicious Bookmark this on Delicious