Fresher to Expert

Github - Reading other's code

If you ask any professional in the industry, what is the best way to improve programming skills, they will give one common advice "Read other's code". Reading other's code is as important as reading your own. Reading master's code is much more desired as it will show you best practices.

Why to read other's code?

Most of people think to get better at programming, they have to code a lot. Those people are half right. As much you write code, you have to read also. Often people wonder why they should read code written by some one else?

In any field people get better by observing and learning from best people in that field. Great writers are also great readers. In one of the interview, George Martin, author of Game of Thrones told "It is very important that you read lot of books before you write one". Reading books teaches writer how to construct different pieces of story and put together in a nice manner. It's also true in field of music. Many people learn to play different instruments by watching others play.

Same way you can learn great things of building software by reading other's code. By reading, you can understand how different abstractions in the programming is achieved. If you read code of masters in the field, you will be surprised to find out how straight forward their code is and how they compose things nicely. As Erik Meijer, inventor of Reactive programming, says "Great programmers write baby code" .

Reading other's code is not easy

Like it is not easy to read new author's book, it's not easy to read other's code. To understand other's code, you should understand their style of expressing things. Every author/programmer has their own way of expressing things. Also different people have different priorities. Some programmers are obsessed by the performance whereas some are obsessed by the readability of code. So it will take time for you to get used to the reading. It will be hard in the beginning but don't give up. Over a time you will become master at reading other's code.

Everyone has their own way of reading. If you want to know how the best programmers read other's code read "Coders at Work" book, referenced in earlier chapter.

Open source

Now you have convinced that you should read other's code. But you may be thinking why people will give access to their code? Even if they give the are going to charge right?. Don't worry. There are so many good people in world, who put out their great creations in public to read and use it for free. This way of doing things is called OpenSource.

Lot of people think open source is getting things for free. But the actual underlaying principal of open source is to learn from others knowledge. The great projects like Linux,Android,Chrome etc are open source which means you can look at their code and learn from it.

Github - Repository of open source code

Github is a website which hosts large repositories of open source. You can freely sign up to this website and browse through all public repositories. You can also download the code and many times you can extend also!.

Repositories to start with

The following are few of the repositories you can start your journey of reading code

  • jQuery - Complete source of famous javascript library JQuery.
  • underscore.js - Small javascript library which teaches you advanced javascript
  • JSON- Parsing JSON in javascript with less than 500 lines
  • Junit - Unit testing framework in Java.
  • Java collections - Java collections source code is one of the best way to learn Java.
  • Linux Kernel - Complete source code of Linux Kernel. Only for adventures people!!!

Reading other's code is an art. It takes long time to learn. So have patience and start reading code