News for hackers. Stuff that matters.
Re:Reading Code is Key to Writing Good Code by antirez on Thursday November 19, 2009 @06:02AM (#950047)
I don't know if my code qualifies as good code, but well anyway I want to share that I never read code in my programmer life without the need to read code.

I read code when I've to modify it, or when I'm really curious about how something is working, or when I searched for bugs back in my "security researcher" past life. But it was either needed or fun. To read code as an exercise can be pretty boring I guess, this is not what programming should look like.

I can't see how there is so much value in reading a big codebase that expresses more or less the same style and patterns in many places. Maybe it's better to check for some interesting code in different projects. I bet that reading SICP or an algorithms book and to code a lot is a much better way to spend your time.

A good approach IMHO is to try to write some non trivial code, for instance an interpreter for a simple programming language, and if you have problems try to check what other code looks like and how it address the same problems you are facing. Then it will no longer be a pain to read parts of the implementation of Ruby or Python or Tcl, since you are discovering very interesting things, solutions to problems you encountered.

Another thing that's worth a lot more your time is to learn new programming languages. But there is no point in learning Python if you know Ruby, or the contrary. You should try to learn languages that are really different. For instance SmallTalk, FORTH, Lisp, C, Assembler, Haskell, Joy, Ruby, Tcl are different enough.

There are no comments on this comment yet.