Software Development
Blogs and Discussion
developer.*
Books Articles Blogs Subscribe d.* Gear About Home

Apgar, Metrics, and CVS

When I read the article Daniel referred to in his Apgar score post, I thought I knew exactly what the relevance of the article to software engineering. It turned out I was focusing on a completely different passage than Daniel was. Here's what I focused on:

...Babies who were born malformed or too small or just blue and not breathing well were listed as stillborn, placed out of sight, and left to die. They were believed to be too sick to live. Apgar believed otherwise...

[Thus Dr. Apgar developed her scoring system to counter this problem.]

...even if only because doctors are competitive, it drove them to want to produce better scores—and therefore better outcomes—for the newborns they delivered.

Around the world, virtually every child born in a hospital had an Apgar score recorded at one minute after birth and at five minutes after birth. It quickly became clear that a baby with a terrible Apgar score at one minute could often be resuscitated—with measures like oxygen and warming—to an excellent score at five minutes.

This got me thinking to a conversation a friend of mine and I have been carrying on over a period of some years now. We started out by observing that some managers did not seem to believe there were any substantive qualitative difference between programmers, and moreover, those few that did usually were incapable of accurately distinguishing a good programmer from a bad one.

Moreover, poor programmers often do not see themselves as such. They get assigned requirements, they write a crappy, unscalable solution for those requirements, and they still go home confident that they've done a good job.

Similarly, obstetricians saw no difference in outcomes between a stillbirth and a healthy child: they got paid either way. Surely, if they knew that they had let a baby that could have been saved die, they would feel badly about it, but if they had been trained that a child that was not breathing immediately after birth could not be resuscitated...

For software developers, frequently it's even worse than that. If a child is born to a poor obstetrician, after it goes home it's generally safe from further malpractice. Once the software with the low Apgar rating hits the streets, it generally will get maintained by the same developer - if for no other reason than the author is the only one who can read the code.

What happens next is what my friend and I found really disturbing: The unskilled developer is seen as a big hero because whenever something goes wrong, this fella comes running in at whatever hour of the day and, within a couple hours, has the program up & running again. Hurray! The hero saves the day! Whereas when a problem develops in well-written code, it often takes a long time to solve. From the standpoint of management, the bad programmer is the genius because he solves lots of problems quickly and the good programmer is useless because it takes a longer for him to solve the problem.

Managers and Executives only know about problems that actually happen. Problems don't happen nearly so often in good code and when they do, the problems usually run deep. Further, non-programmers usually are not equipped to understand that the problem that afflicted the well-written application was far more substantive than the dozens of tiny problems that beset the poorly-written code.

Software quality metrics rarely work. I don't think I could say it any more eloquently than Brad did when he said "For any metric you can design, I can write crappy software that meets the metric perfectly."

Moreover, I know a lot of superbly written code that never got ran, and I know some crappy code that runs every day and enjoys widespread acclaim amongst its users. I know this with some certainty because I've written both. Moreover, I think that most people, myself included privately define "high quality" software as software that looks like software that they wrote.

You can go on about one pet peeve or another, but just as Brad can write crappy code that meets the definition of quality code by the software metrics, I can write great code that breaks the metrics. At least if you let me define "great" as highly reliable, scalable, and exceeding customer expectations.

When I was younger, I observed that whenever I looked at code that I wrote a couple years ago, I was always appalled that I could ever have written anything so crappy and thought it was good. I think most good developers have that same feeling. Now that I've, uh, "matured" a bit, I've utterly changed what I view as "good" and "bad" code. In my new way of thinking, "good" code gets run. "Bad" code doesn't. It's that simple.

For example, I wrote a program in a great hurry many years ago that would fail any reasonable programmer's definition of good code. That code got run for years and years without anybody doing maintenance on it. It wasn't extensible, but then nobody wanted to extend it (or at least not badly enough to want to try to penetrate how it worked). It wasn't scalable, but the dataset size remained constant. So, how can you say that this was bad code? It delivered more customer value than any product I have written before or since!

Still, this is an unusual case and its "good code" standing probably owes more to luck than skill. In general, I think it's probably safe to say that poor quality code tends to get maintenanced-out of the product. If it gets run that is.

My notion, which I'll put to the gallery for comment and ridicule, is that it might be possible to write a tool that looks at the Source Code Control database and ferrets out who writes the code that hits and sticks, versus who writes code that gets patch after patch applied to it.

If you had such a tool, I believe it would have the same social impact as the Apgar score: engineers who thought they were good coders might finally start to realize that they are not, and be motivated to learn new techniques that might improve their score.

similar ideas

In his OSCon 2006 presentation 10 Tools for Open Source Projects, Karl Fogel presented some similar ideas about using tools to evaluate bug reports and repository commits to screen potential commit-bit cendidates or other folks who would be good to groom for a bigger role in an open source project. I can't find any links to his talk right now, but I think it was released as an mp3 somewhere.

I detect a self-contradiction

See my extended post "Squaring the Circle"

Bugs via SCM

Hi Pat, there was a video on Google video about predicting bugs using source control information. Not sure if its the same one. The video is here.

Google Video

That was quite an interesting talk! At one point the speaker calls out data that seems to conclusively show that, almost all of the time, the committer turns out to be a useless predictor of whether a commit will be buggy or not.

Honestly, I'm not entirely surprised. I think good programmers can be as error prone as bad ones. What I think distinguishes a good programmer from a bad one is the survivability of their code. That is, the good coder will check in reusable components that last in the product, unchanged, for many years. The bad programmer will treat each new challenge as a separate entity and never write much code that is reused. When their code does persist, it's usually because it becomes dead code.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Recent comments

User login

About our advertising.

Atom Feed

developer.* Blogs also has an Atom feed, located at this url.

Click here for more information about Atom.

A Jolt Award Finalist
Software Creativity 2.0
Foreword by Tom DeMarco

Recent Posters

Based on most recent 60 days, sorted by # of posts and name.

Google
Web developer.*

Who's online

There are currently 0 users and 28 guests online.

Syndicate

Syndicate content
All views expressed by authors, bloggers, and commentors are their own and do not necessarily reflect the views of developer.* or its proprietors.
Click to read the Copyright Notice.

All content copyright ©2000-2005 by the individual specified authors (and where not specified, copyright by Read Media, LLC). Reprint or redistribute only with written permission from the author and/or developer.*.

www.developerdotstar.com