Do Professional Programmers Need a Code of Conduct? An Interview with Robert C. "Uncle Bob" Martin
Robert C. "Uncle Bob" Martin is no stranger to being on the cutting edge of software development. A co-author of the Agile Manifesto, his company, Object Mentor Inc., provided the first Extreme Programming training courses called Extreme Programming Immersion. After publishing half a dozen books on software techniques and methods, over the past few years he has shifted his focus to the emergent software craftsmanship and software professionalism movements.
At the same time, Bob belongs to a rare breed; the from-the-ranks programmer who remained technical even after founding and running Object Mentor, a successful consulting company.
In this interview, Matt Heusser talks to Bob about being a programmer, why they need a code of conduct, getting fired, and how to come up with a truthful estimation.
Matt: Many people talk about moving "beyond" programming to "bigger and better" things; yet you've chosen to remain technical. Tell us about how and why you made that decision, and what it has meant for you.
Bob: I'm a programmer. I love being a programmer. I want to code till I die. To quote one of my heroes, Isaac Asimov, I want them to find me with my nose stuck between the keys of my computer.
Oh, I've been through the mill. I fell for the lure of management in my late 20s and early 30s. I've run groups and teams. I've even run a company. But it's not my first love. I find it tedious. I'd rather teach, speak, and write code.
Many young programmers will face this dilemma. They will feel that their career will be limited unless they climb the management ladder. Balderdash! Your career is limited only by your passions and abilities, not by whether you go into management. If you want to be a technical superstar, then go for it! Believe me, there's a need and a market for master craftsmen who are very well paid. Don't let anyone force you on a path you don't choose for yourself; and never let your employer decide your career for you.
Matt: Writing a code of conduct implies programmers need a code of conduct, or are somehow lacking one, doesn't it?
Bob: Programmers are sorely lacking a code of conduct. I compare the software industry to medicine in the dark ages. Anybody could claim to be a "healer". Some did good. Others did bad. There were no standards. Few of those "healers" knew of the Hippocratic Oath.
What does it take to be a programmer? Pretty much you can be hired as a programmer if you tell someone you know something about computers. Some companies have higher standards than others; but the ranks of programmers are littered with people who can't write a line of code to save their souls. There are many more who can write code, but we wish they didn't. It's not a good state of affairs. Worse, even the good programmers don't know how to behave. They may be technically skilled, but they don't understand what is expected of a professional. Many feel that their employers are their bosses. Nothing could be further from the truth. Professionals don't have bosses. Professionals are partners with business. They may be employed, but they are not laborers to be managed by foremen. Rather they are experts who know how best to achieve what their employers need. You hire doctors and lawyers, but you don't manage them, you aren't their boss. Imagine trying to boss your doctor as he performs open-heart surgery on you. The concept is absurd. That's the bar I want programmers to reach for. I want them to behave like lawyers, like doctors, like real professionals; not like laborers.
Matt: Do you think it's fair to say that you are actively working to bring programming "up" as a profession—to make it both more respected but also more respectable? If you are, what is your end goal?
Bob: I will be satisfied that we've made some progress when programmers realize that they are experts and not laborers. The first step along that path is to learn how and when to say "no". As a programmer I don't have to meet the deadlines set for me by my employer. I will set my own deadlines. I will inform my employer when my objectives will be met. I will decide the best way to achieve those objectives. I will work with my employer to create a plan that satisfies his needs as well as they can be satisfied; and I will meet that plan. But I will not promise to do something that I don't believe I can achieve.
Matt: It seems to me that at the typical organization, the schedule comes down from on high and is sort of ... inflicted on the technical staff. Do you think your vision of professionalism is "swimming upstream?"
Bob: Not at all. Managers need to know what the truth is. Since they aren't usually technically competent (anymore), they pick a date that's convenient for them and then challenge developers to meet it. They expect a fight. If developers don't give them a fight they assume that the date was reasonable to begin with. If developers do give them a fight then they negotiate until common ground is achieved. If developers cave before they reach a date they believe in, then those developers are responsible for the ultimate failure.
Managers are responsible for schedule and budget; and they will defend them to the max. They expect developers to defend their concerns to the max too. So when developers agree to a date, no matter how tentatively, manager believe they have found the "truth".
Matt: Let's say the programmer wants to be a professional, but is hired into one of these less-enlightened organizations. The big boss hands him the feature list and schedule. Now what?
Bob: Ignore the schedule. Look at the feature list and come up with your own schedule—a schedule you believe in; a schedule you can commit to in good conscience. Better yet, come up with three schedules. An optimistic schedule that's 3 sigma better than the mean. The mean schedule that you think has a 50-50 chance of being right, and a pessimistic schedule that's 3 sigma more than the mean. Remember that 3 sigma is 95% so we're talking about extremes here. Giving estimates in this form is very honest because it tells the managers that you don't know for sure how long it will take, and it gives them the shape of the uncertainty. (See PERT)
Alternatively, walk through the feature list, and tell the big boss what's possible by the requested date. Again, try to describe this in terms of 3 sigma so that managers have an idea of the shape of your uncertainty.
Under no circumstances should you allow a manager to pressure you into saying that you'll "try". There is no trying. If you say you'll "try" you have committed to succeeding.
Matt: We've spent a fair amount of time talking about schedules, but I'm sure there are other aspects to your code of conduct. Can you tell us about the rest of it? If you had to boil it down to bullet points, what would those be?
Bob: If I boil it down to just one bullet point it would be: "Be Honest". That's really what the whole book is about. It's about telling the truth to everyone, all the time; including yourself.
In the book, I break this down in to chapters whose titles are:
- Professionalism - The basics of finding and telling the truth.
- Saying No. - Sometimes the most honest, most important, and most beneficial thing we can say is: No. It can be hard to hear, and even harder to say, but if you can't say it, you can't call yourself a professional.
- Saying Yes. - Our goal is to say yes. We want to say yes. So we need to know how to say yes without saying more than we intended.
- Coding - Writing code is hard. If it weren't it wouldn't be so much fun! But since it's our job, we have to do it well and consistently. So how do you keep yourself prepared? How do you deal with writer's block? What do you do if you are late? How can you code after a big fight with your wife? And what is the "Zone”?
- TDD - A technical discipline that, for my money, has become a minimum requirement for professional behavior. The chapter does not go into the technical details of the discipline. Other books do that. This chapter is all about the moral and professional aspects of TDD.
- Practicing - All professionals practice. They hone their skills through repetitive exercises. How can programmers do the same? Should they?
- Acceptance Testing - The professional needs to communicate requirements effectively. One way to do this is by reducing requirements to executable statements called acceptance tests.
- Testing Strategies - How can you call yourself a professional if you don't know your code works? How can you get this certainty?
- Time Management - What strategies can you employ to be sure you are using your time as well as possible?
- Estimation - How can you estimate truthfully? How can you keep your estimates from becoming commitments?
- Pressure - The pressure will come. When it does, how do you deal with it?
- Collaboration - Professionals do not work alone. What are some of the best ways to work together?
- Teams and Projects - How can professionals be arranged into teams that work well together?
- Mentoring, Apprenticeship, and Craftsmanship - It is a professional's responsibility to groom more professionals. What is the best approach?
There's something that this list of topics misses. In a very real sense this book is something of a professional autobiography. I tell lots of stories from my own career. Many of those stories aren't pretty; but they are informative. I describe my errors, my debacles, and my disasters. I describes times I lied, and times I failed, and even times I was fired. I describe the school of "hard knocks" that forged my current attitude on professionalism.
Matt: You say you've been fired before—and it was a good thing? Tell us about that. Have you ever walked off a job?
Bob: It's never a good thing to get fired, especially when your wife is pregnant with your first child and the economy is in the midst of the 1975 recession. But it was certainly a learning experience. I made some very stupid mistakes back then. Not in my code, but in my behavior. I wasn't trying to disrespect my job; but I wasn't trying to respect it either. Dates and times simply didn't matter to me. In the end, despite my technical abilities, they couldn't tolerate me. It was an error I tried hard not to repeat!
Yes, as a teenaged programmer I once even walked off a job in a pique of self-righteous indignation. I sure showed them! After that I couldn't find a programming job for 3 months and repaired lawnmowers instead. This is not something I recommend.
Matt: Back to your points of professionalism; how do you estimate truthfully? What should an estimate be 'worth'?
Bob: You estimate truthfully by making sure that everyone understands that the estimate IS an estimate. One way to do that is to include a measure of your own uncertainty with the estimate. e.g. 5 days plus or minus 2. Estimates are never certain. If they were certain we'd call them quotes not estimates. Giving a single date or duration and calling it an estimate is essentially a lie of omission. You have left out the most important part: the uncertainty; the thing that makes it an estimate in the first place.
Matt: I can appreciate that. Can you give us an example of how to draw the line when saying 'yes'? Not only what to say in the face of the pressure, but also how to know where the line is?
Bob: The most important thing about saying "yes" is to distinguish between an estimate and a commitment. An estimate is not a promise. An estimate is a guess, loaded with uncertainty. A commitment is a promise you must not miss. That's where the line is. You only say you'll do something if you know you can do it. Otherwise you provide the best estimate you can, including all the uncertainty with that estimate. For example, consider Programmer Pete, and Manager Mildred.
Mildred: How long will this task take you Pete?
Pete: About three days.
Mildred: Good. That's Friday. That'll be fine.
Pete: I didn't say Friday. I said about three days. It might be Monday, or even Tuesday.
Mildred: I really need it by Friday Pete.
Pete: I'm sorry Mildred, but I can't promise you that.
Mildred: Can't you try?
Pete: I always try. But I still can't make the promise.
Mildred: Well, what can you promise?
Pete: If you need a hard promise, then I can commit to Wednesday.
Notice the difference between the estimate of Friday, and the commitment of Wednesday. Pete thought he could get done by Friday but wasn't sure; so he refused to turn his estimate into a commitment. When asked to commit, he made a promise he knew he could keep.
This is honest, and professional. You draw a hard line between estimates and commitments, and you make sure everyone knows where that line is.
Matt: It seems to me that the majority of your work could apply to a great number of vocations (TDD and clean code aside). Has your work had an impact outside of programming? Should it? If it should, do you have any plans to 'broaden' you work?
Bob: I suppose you are correct about that; but my interest lies with programming and programmers. I have neither plans nor any desire to broaden my work outside of that domain. Others may extrapolate my work to different domains if they desire (some already have); I'll continue to focus on programming.
Matt: Thank you for participating. Where can we go for more?