Having tried my hand at the creative side of life (read “writing stories”), I have often heard from the veterans that one needs to read a lot to be a good writer. I couldn’t agree more. You see how writers play with words and you are tempted to do it yourself. You read a good piece and say “I wish I had written that” or “I wish I could write like that”.
I felt the same when I saw a piece of code today. It’s written by one of our senior most programmers who I am in awe of. It’s around 15 lines of Perl code. It’s neat, compact, efficient and awesome! It took me 20 minutes to figure out all the constructs that piece of code used. I admit I am not all that familiar with Perl.
This led me to this thought: Do you need to read others’ code to become a good coder? Certainly. If I hadn’t looked at the Perl code, I would have never imagined one could write code like that! Sadly, I don’t even remember when I read somebody’s code because I wanted to read it. Code review, code digging, debugging – I have done all this. But, reading code for the heck of reading it: No.
Lesson learnt: Read more code from this senior programmer.