Bernie Cosell
542
Cosell: I have to admit that I did both. I would make things simple in the
large. But when I say that programs should be easy, it’s not necessarily the
case that specific pieces of the functionality of the program have to be easy.
I could write some very complicated code to do the right thing, right there,
code that people would cringe at and not be willing to touch. But it was
always in an encapsulated place.
Most of the bad programs I ran into, the ones where I threw things out and
recoded them, there wasn’t a little island of complexity you could try to
understand and fix, but the complexity had oozed through the program.
I have a couple of rules that I try to impress on people, usually people fresh
out of college, who believe that they understand everything there is to
know about programming. The first is the idea that there are very few
inherently hard programs. If you’re looking at a piece of code and it looks
very hard—if you can’t understand what this thing is supposed to be
doing—that’s almost always an indication that it was poorly thought
through. At that point you don’t roll up your sleeves and try to fix the code;
you take a step back and think it through again. When you’ve thought it
through enough, you’ll find out that it’s easy.
We just did that recently at work. They were working on some big design
project and it was just getting more and more convoluted. So we had a
meeting and started shedding away things. I said, “That seems too
complicated.” And all of a sudden, we had a block diagram for how the thing
would work. And everybody was stunned because they understood how
each block could possibly do its job. We hadn’t done the dull things where
you have to write it all down but they understood that the interfaces were
clean and they could make progress. I’ve done this business long enough to
understand that there are some very hard problems. But very few. It’s
invariably the case that when they think about it harder, it gets easier and all
of a sudden it’s easy to program correctly.
The other rule is to realize that programs are meant to be read. Even
though I’m guilty of writing pages of TECO macros back in my early days, I
very quickly—probably when I was working on the PDP-1 time-sharing
system and the complexity of the time-sharing system started to sink in—
came to the belief that computer-program source code is for people, not
for computers. Computers don’t care. I think it’s a good thing that Perl has