In the last few weeks I led a life writing C programs 10 hours a day. It was interesting and frustrating, and I learned a lot from that. For one thing, programming is an enjoyable game to me. It drives me thinking problems, force me constructing ideas and making proper solutions. What’s more fascinating is, the machine would tell me whether my solution program is right or wrong in less than a second. The frustrating part is, it always tells me I was wrong. Truth to be told, I am not a good programmer as my friends thought. Hours and hours, I wasting time debugging my programs and finally found out I was wrong at the first thought. So, the problem is, what can I do with that?

The answer generally came to my mind: The Better Way to learn programming is to get away from it. Don’t panic, I don’t mean not programming, I mean not programming that soon. We live in an era that computers and internet are easy to access anytime and anywhere, which is lucky, or maybe unlucky to all of us. One story told by Alan Kay explained my reason:

When I was at Stanford with the AI project [in the late 1960s] one of the things we used to do every Thanksgiving is have a computer programming contest with people on research projects in the Bay area. The prize I think was a turkey.

[John] McCarthy used to make up the problems. The one year that Knuth entered this, he won both the fastest time getting the program running and he also won the fastest execution of the algorithm. He did it on the worst system with remote batch called the Wilbur system. And he basically beat the shit out of everyone.

And they asked him, “How could you possibly do this?” And he answered, “When I learned to program, you were lucky if you got five minutes with the machine a day. If you wanted to get the program going, it just had to be written right. So people just learned to program like it was carving stone. You sort of have to sidle up to it. That’s how I learned to program.”

The dean of my undergraduate CS department has similar experience. When the time they learned programming, the computer didn’t even has a BIOS. They had to use punched cards to operate the machine. Each program they ran has been wrote and reviewed many times. That generation students, have all become something in the field of academic now.

What I learned from these is, gcc -Wall -pendantic-error seems an easy and relatively friendly way to detect where were you wrong in your programs, but scratch paper and pencil would be your more loyally friend when you struggling figuring out the solution of programs.

Someone might ask, does it still worth in nowadays? As a successful example with plenty failure experience of rush to program first each time, I have to say, probably yes, but not necessary. Some of us with strong ability of abstraction may find is easy to run programs with no errors and warnings at first time. They usually adopt a top-down approach to organize their code: design structures and interfaces first, then implement the details. The classic example of this philosophy could be found in Robert Sedgewick’s <Algorithms>.

The sad fact is that most people, me included, cannot. So, close your laptop, make a cup of tea, prepare a pencil and some scratch paper, start to program with your brain.

Last but not least, learn to enjoy the life out of the computer science world would also helps you in computer science field. Like Eric S. Raymond’s words in <How to become a hacker>:

Again, to be a hacker, you have to enter the hacker mindset. There are some things you can do when you’re not at a computer that seem to help. They’re not substitutes for hacking (nothing is) but many hackers do them, and feel that they connect in some basic way with the essence of hacking.

  1. Learn to write your native language well. Though it’s a common stereotype that programmers can’t write, a surprising number of hackers (including all the most accomplished ones I know of) are very able writers.

  2. Read science fiction. Go to science fiction conventions (a good way to meet hackers and proto-hackers).

  3. Train in a martial-arts form. The kind of mental discipline required for martial arts seems to be similar in important ways to what hackers do. The most popular forms among hackers are definitely Asian empty-hand arts such as Tae Kwon Do, various forms of Karate, Kung Fu, Aikido, or Ju Jitsu. Western fencing and Asian sword arts also have visible followings. In places where it’s legal, pistol shooting has been rising in popularity since the late 1990s. The most hackerly martial arts are those which emphasize mental discipline, relaxed awareness, and control, rather than raw strength, athleticism, or physical toughness.

  4. Study an actual meditation discipline. The perennial favorite among hackers is Zen (importantly, it is possible to benefit from Zen without acquiring a religion or discarding one you already have). Other styles may work as well, but be careful to choose one that doesn’t require you to believe crazy things.

  5. Develop an analytical ear for music. Learn to appreciate peculiar kinds of music. Learn to play some musical instrument well, or how to sing.

  6. Develop your appreciation of puns and wordplay.

PS: After writing this post, I found Jeff Atwood wrote a similar article in 2007, here it is How To Become a Better Programmer by Not Programming.