2007-12-25

Code smaller

Ladies and gentlemen of the class of '07: code smaller!

If I could offer you only one tip for the future, slim code would be it.

The long-term benefits of small code bases have been proved by scientists, whereas the rest of my advice has no basis more reliable than my own meandering experience.

Enjoy the power and beauty of your language.

Oh, never mind. You will not understand the power and beauty of your language until you have been forced into adopting a less powerful and beautiful language.

But trust me, in 20 years, you'll look back at and recall in a way you can't grasp now how much possibility lay before you and how fabulous that language really was.

You do not have to write as bloated software as you imagine.

Don't worry about the future.

Or do, but know that trying to design future-proof software is as effective as trying to solve an algebra equation by chewing bubble gum.

The real troubles in your code are apt to be things that never crossed your worried mind, the kind that blindside you at 4 am on some idle Tuesday.

Do one thing every day that scares you.

Think.

Don't be reckless with other people's projects.

Don't put up with people who are reckless with yours.

Refactor.

Don't waste your time on jealousy.

Sometimes you're ahead, sometimes you're behind.

The race is long and, in the end, it's only with yourself.

Remember compliments you receive. Forget the insults.

If you succeed in doing this, tell me how.

Keep your old fan mail. Throw away your old time reports.

Eat.

Don't feel guilty if you don't know what you want to do with your life.

The most interesting people I know didn't know at 22 what they wanted to do with their lives.

Some of the most interesting 40-year-olds I know still don't.

Get plenty of sleep. Be kind to your wrists. You'll miss them when they're gone.

Maybe you'll gain a following, maybe you won't.

Maybe you'll spawn sub projects, maybe you won't.

Maybe you'll leave the field at 40, maybe you'll release The Next Big Thing on your 75th wedding anniversary.

Whatever you do, don't congratulate yourself too much, or berate yourself either.

Your choices are half chance. So are everybody else's.

Enjoy your craft.

Use it every way you can. Don't be afraid of it or of what other people think of it.

It's the greatest instrument you'll ever own.

Hack, even if you have nowhere to do it but your living room.

Read the manuals, even if you don't follow them.

Do not read industry best practices. They will only make you feel inferior.


Get to know your ancestors. You never know when they'll be gone for good.

Be nice to your competitors. They're your best link to your past and the players most likely to stick with you in the future.

Understand that peers come and go, but with a precious few you should hold on.

Work hard to bridge the gaps in geography and lifestyle, because the older you get, the more you need the people who knew you when you were young.

Live in New York City once, but leave before it makes you hard.

Live in Silicon Valley once, but leave before it makes you soft. Travel.

Accept certain inalienable truths:

Codebases will grow. Heroes will change alliances. You, too, will get old.

And when you do, you'll fantasize that when you were young, code sizes were reasonable, heroes were noble, and newcomers respected their elders.

Respect your elders.

Don't expect anyone else to support you.

Maybe you have a day job. Maybe you're funded by wealthy investors. But you never know when either one might run out.

Don't turn a blind eye towards ergonomics, or by the time you're 40 you will feel 85.

Be careful whose advice you buy, but be patient with those who supply it.

Advice is a form of nostalgia. Dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than it's worth.

But trust me on the small code bases.

With thanks to Steve Yegge (via Jeff Atwood via Simon Willison), Joel Spolsky, Paul Graham et al, and apologies to Baz Luhrmann.