At one point as a grunt in the Israeli Army, I was assigned to work for a high-ranking sergeant major. This guy had years of experience. He was probably 20 years older than me and the other kids in the unit. Even in the field, he always looked immaculate -- he wore a spotless, starched, pressed, full-dress uniform with impeccably polished shoes no matter how dusty and muddy the world around him got. You had the feeling that he slept under 300-thread-count Egyptian cotton sheets each night while the rest of us rolled around in dusty sleeping bags on the ground.

As for the sergeant major's job, it basically consisted of two main duties: being the chief disciplinary officer and maintaining the physical infrastructure of the base. As such, he was a terror to everyone in the battalion. Most people knew him only from the way he strutted around, conducting inspections, screaming at the top of his lungs, and demanding impossibly high standards of order and cleanliness in what was essentially a bunch of tents in the middle of the desert -- tents that were alternately dust-choked or mud-choked, depending on the rain situation.

Anyway, on my first day of work for the sergeant major, I didn't know what to expect. I was sure it was going to be horrible, a suspicion that seemed to be confirmed when he took me to the officers' bathroom and told me I would be responsible for keeping it clean. And then he said something I didn't anticipate.

"Here's how you clean a toilet," he said.

And he got down on his knees in front of the porcelain bowl -- in his pressed-starched-spotless dress uniform -- and scrubbed it with his bare hands until it shined.

To a 19-year-old assigned to clean toilets, which is almost by definition the worst possible job in the world, the sight of this high-ranking, 38-year-old, manicured, pampered disciplinary officer cleaning a toilet was a shock. And it completely reset my attitude. If he can clean a toilet, I can clean a toilet, I thought. There's nothing wrong with cleaning toilets. My loyalty and inspiration from that moment on were unflagging. Now that's leadership.

I thought about the sergeant major recently when my company, Fog Creek Software, moved into a new building in New York City. Anybody visiting the new space soon after we moved in might have been surprised to see me and my partner, Michael Pryor, drills in hand, climbing ladders and hanging blinds in all of our programmers' offices. Michael is the co-founder, president, and CFO of the company. I'm the co-founder, CEO, and Lord High Everything Else.

Given that we just dropped half a million dollars fixing up the place, you're probably thinking it would have made more sense to ask the contractor to put up some blinds. Well, actually, the contractor did put up venetian blinds. But they were astonishingly ugly, so we had to pay another $2,000 to get them taken down. Lesson learned: When your walls are superwhite, anything off-white or cream-colored is going to look old and dirty.

I thought I'd wait to see whether we really needed blinds in all the offices before buying replacements. After a couple of days, it became pretty clear that we did. The programmers' offices that faced east baked in the morning as the sun poured in. The greenhouse effect combined with glare on the monitors made it hard for them to get work done.

So I ordered blackout honeycomb blinds over the Internet. They're the same ones I have in my apartment, so I knew they would look good. When they arrived a few days later, I set out to install them.

First problem: What kind of mounting hardware should we use? The options included plastic anchors, molly bolts, and toggle bolts. Toggles seemed like the most robust solution, so I went to a nearby hardware store and bought a few boxes.

Second problem: The 2-inch bolts were too short, but the 3-inch bolts were too long. So we had to get 3-inch bolts and cut them. After we cut every bolt, then we had to drill test holes to make sure the bolt fit. Naturally, we found a big old pipe right behind the wall where we wanted to install the shade, and we had to keep drilling test holes in different places until we finally found a spot that would work.

Third problem: We soon discovered that drilling big holes in the ceiling tends to spray a lot of dust everywhere. That weekend, I caught an episode of This Old House on television. Tom Silva was sawing out some rotted drywall from a ceiling, and he had the homeowner hold up a vacuum-cleaner hose right where he was cutting to suck up all the dust before it created a gypsum winter wonderland. Lo and behold, that trick worked pretty well for us, too.

All told, installing the blinds took me and Michael two afternoons of work. I'm well aware that any half-competent handyman could have handled that task for not much money. The cost in most neighborhoods would be about $100; in our pompous Manhattan office building, that roughly translates to a much-more reasonable price of $1,000. But, still, it was perfectly affordable.

And Michael and I could have spent the time, in theory, doing something a lot more valuable. Indeed, I had pulled Michael away from an important project in order to help me with the blinds. He was implementing a program our customers had been begging for -- a feature that allowed them to prepay for a year's worth of service. That program promises to increase our bank balance substantially, and it won't cost us one extra cent.

But as I'm sure you've guessed, I was trying to make a point, just like the sergeant major. In our company, management's job is to get things out of the way so that all the great people we've hired can get work done.

This is not just lip service.

Getting glare off the computer monitors so that people can write code actually is my highest priority.

I'd love to imagine that I'm the most valuable person in the company, that my time is so precious that I have to optimize every minute. But it's not true. At this point, I'm probably the worst developer in the office. And people have made so many changes to the tools we use to develop FogBugz that I don't even know how to compile new features, let alone develop them.

Our company was built on the idea of hiring smart and productive people and then clearing the decks. The late, great minicomputer company Digital Equipment Corporation, better known as DEC, was so adamant about this idea that people in the company used the word administration in place of management and modeled its corporate hierarchy on that of a great research university.

The brains behind the university are the professors. They do the groundbreaking medical experiments on rhesus monkeys and gain insight into the psychology of man by closely observing the behavior of college sophomores. Obviously, these geniuses shouldn't waste a moment of their valuable time on administrative tasks.

Thus, universities hire support staff to collect tuition payments and figure out who should get that great parking space near the duck pond. (At the very most, a good university might rotate the administrative tasks among the faculty, but ideally, it has a team of professionals to keep the trains running on time.) DEC behaved in much the same way.

And that's my model, too. Not everybody gets it. Not long ago, we had a management trainee who sat around waiting for us to give him a formal title and promotion so he could "get stuff done." Problem was, he had never managed to win enough respect or influence from the development team to actually do things. He didn't work out so well; despite being smart and competent, he didn't earn the leadership position he thought he deserved. He would have been better off thinking about new features we should develop, writing specs to outline the benefits of these features, and winning the developers' trust through action instead of waiting for the title.

Another management trainee didn't care what his title was: He came up with a new idea for a program and persuaded the team that it was a good idea. I think he'll go far.

That's the kind of leader I want to nurture at my company. I'm working hard to make Fog Creek Software a place where authority and respect are earned and not bestowed. A place where management is an administrative function -- and not a particularly glamorous one at that. I'm betting that's the kind of company that can attract and keep the software talent that I hope will invent the future. And while those people are busy doing that, I'll keep an eye on the blinds and the toilets.

Joel Spolsky is the co-founder and CEO of Fog Creek Software and the host of the popular blog Joel on Software.