Read some code today

Programmers like to write code. But how many like to read code? Likely very few.

So why is this the case? The main reason may be because reading somebody else’s code may not be a lot of fun. Particularly if it is poorly documented, or poorly structured. Oh yeah, “those things don’t really matter”, I hear you tell yourself. Try reading a piece of code that lacks proper formatting, that is full of “shortcuts”, and has no documentation – you will quickly abandon it. One persons elegance is another persons character dump.

But why would you want to read code? Boooooorrrring. Well here’s one reason – it is possible to learn new ways of writing algorithms, creating data structures, or handling exceptions. If you are a novice programmer, then reading code will help you understand how certain control structures, and data structures are used in the context of a program that works. You can take a piece of existing code and modify it – see what it does. You may learn more than reading some boring book on programming.

If you have some experience programming, go back and read some of your own code. Do you still know what it does? Bet it probably lacked some structure, and probably isn’t commented very well, is it? Maybe consider looking at an algorithm written in different languages. Reading code will improve your skills at programming in a similar way that reading copious literature will hone your writing skills. Reading code improves your language vocabulary, and your ability to craft code in different ways.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s