97 Things Every Programmer Should Know

(Chris Devlin) #1

Collective Wisdom from the Experts 117


Joe nodded. “And I hate to say it, but I’m pretty smart, too!” Joe grinned. “So if
I can’t easily understand what you’ve done here and your very smart younger
brother will likely puzzle over this, what does that mean about what you’ve
written?” Joe looked at his code a little differently, it seemed to me. “How
about this,” I suggested in my best “I’m your friendly mentor” voice, “Think of
every line of code you write as a message for someone in the future—someone
who might be your younger brother. Pretend you’re explaining to this smart
person how to solve this tough problem.


“Is this what you’d like to imagine? That the smart programmer in the future
would see your code and say, ‘Wow! This is great! I can understand perfectly
what’s been done here and I’m amazed at what an elegant—no, wait—what a
beautiful piece of code this is. I’m going to show the other folks on my team.
This is a masterpiece!’


“Joe, do you think you can write code that solves this difficult problem but
will be so beautiful it will sing? Yes, just like a haunting melody. I think that
anyone who can come up with the very difficult solution you have here could
also write something beautiful. Hmm...I wonder if I should start grading on
beauty? What do you think, Joe?”


Joe picked up his work and looked at me, a little smile creeping across his face.
“I got it, prof, I’m off to make the world better for Phil. Thanks.”

Free download pdf