Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a junior developer and am trying to learn by reading open source code (AutoMapper).

My approach would be to first understand the requirements of the software/feature. Then look for specifics on how each requirements were implemented and dive deeper into the code until I've reached the end. I would reiterate until I've covered each requirement.

I understand my question does not have a "best" answer. Please give me some input on what works for you guys. Thanks!

share|improve this question

closed as primarily opinion-based by Ixrec, Dan Pichelman, MichaelT, Snowman, durron597 May 20 '15 at 2:16

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

possible duplicate of Interpreting Others' Source Code – Snowman May 20 '15 at 1:20
up vote 2 down vote accepted

You will have several problems with that approach. First of all, requirements are very rarely (if ever) in one place and very rarely written in stone. You will not be able to find all the pieces of the puzzle and the pieces you find might be out of date.

Your best bet is to understand the 'requirement' on the class or method level. Most open source projects have good documentation on the source level. Once you read the documentation of the method or class, then start looking at the code and see how they try to implement it.

Another good exercise would be to look at the code and work backwards. Read the code and write down what the code does at a high level (pseudo code). Then look at its documentation and see how close you figured out what the method/class does.

These are good exercises when code is written well. If it is written badly, you can very quickly get overwhelmed and it can also teach you bad practices. You are lucky though, as most open source projects are tend to be written well especially when you have more people collaborating on them.

share|improve this answer
Even worse, for open source, requirements rarely exist at all, and the only documentation is often the JavaDocs or equivalent. If I had a nickel for every open source file I've read where the only comments were the BSD, GPL, or Apache license header, I wouldn't have to read code :-) – Ross Patterson Dec 14 '11 at 1:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.