views:

133

answers:

5

Hello,

As a starting programmer with little industry-experience, I find it frustrating to learn a new project which is based on many technologies that I am not familiar with. The project I am working on has about 150 classes with 15000 lines of code, and with its extensive focus on socket and security programming which I have zero experience in, I am not sure where I should start.

With limited documentation and help at hands, self-study is my best resource in trying to understand this project as a whole. I often find myself spending way too much time learning insignificant features of the product while missing out the crucial classes that I should really be focusing on... The main reason why it takes so much time is that I often have to look into Java API reference every few minutes to understand a small code block... I am sure I will eventually learn it through trial-and-error, but I am sure that there are some useful advices and guidelines I can use :)

+1  A: 

Learning a code base takes time. I think the general rule is about 3 months for a new developer to be familiar with a code base.

The only things that really help me are to experiment and see what happens, and get familiar with the API.

Jesse
+2  A: 

Initially, you don't need to understand every line of code.

Borrow a senior developer for a half-hour and ask him to give you the birds-eye view of the architecture - what the major blocks of code are, how they interact, and how the user / usage drives data through the system.

Then spend some time investigating the source for the modules you feel (after the explanation) will give you the best insight into "how it all works".

I have a (probably quite odd) habit of printing out large blocks of sourcecode, and covering a floor with the printouts. Then I can kneel down and crawl around on the floor with a pen and literally draw arrows from point to point, and draw around sections - I find that displaying code in 2D makes it easier to figure things out. It also enables making copious notes that help me understand the flow in more detail.

Before long, you'll start to recognise idioms (stylised ways of doing things) that characterise the code, and eventually you'll find your way into the mindset of the authors. Then everything will be a lot simpler.

While you're on the floor, crawling around, have a laptop+google handy, so you can decipher anything odd you encounter. Also: Coloured highlighter pens FTW.

Make (at least) two passes at understanding the source. The first time don't try to understand any of the minutiae... try to get a feel for "movement" - where data goes, and where execution goes. That will give you a framework for your mental model of the code. When you go through next time, you can start to break down details, but a top-down approach always makes things easier for me.

If you're not familiar with the technologies, language or environment, then do see if there are any books around you can grab. There's a lot more visible space in the real world than you can fit on a computer screen, and having google on a laptop, syntax/library references in a book, and the code all around you makes (for me at least) the whole process VASTLY simpler.

Dave Gamble
+1 for the visual image of the programmer crawling around on the floor highlighting code.
James McMahon
+1  A: 

Pair Programming. Work on the code with someone who has experience with it. Help him or her; have him or her help you. As you work on the more experienced developer's code, you will learn some of what the important aspects of the code are - because the experienced developer knows them. You'll develop a mental model of the software that is reasonably close to the experienced developer instead of chasing down dead-ends and ratholes of your own. Pair.

Carl Manaster
A: 

if you have tests, study them. if not, then write some.

Ray Tayek
Don't try to write tests until you understand the code base. I think that could be disastrous.
James McMahon
+1  A: 

A few things come to mind:

  1. Spend a little time getting familiar with the JDK and its standard classes. Having knowledge off the top of your head will take time and a lot more checking the API spec, but you can also spend some time just browsing without a particular thing you're looking up.
  2. If your project is using some frameworks or libraries, you can often get a high-level view of what these bring to the project by reading the "intro" page on the project site. I think this might be of particular help to you, since you cited unfamiliarity with some of the technologies used in the project as a source of frustration.
  3. If there are any functional integration or regression tests, these can often be a good way to get a handle on what the main entry points into the project are. Having a good grasp of the high-level functionality of a project is often helpful when trying to understand the little details.
  4. If you can find a mentor on your team to show you the ropes, that will probably help a lot.

I think, based on the size of the project you mentioned, that this can be a gentle introduction to production code for you. It might seem big now, but 15000 lines of code is on the smaller side of the projects you might eventually work on during the course of your career.

Remember also that this is necessarily going to be a learning experience for you. It's one of your first projects in the industry, so it might take a little while to get used to things. Keep in mind that you're not the first person to have to swim in library / framework soup in an unfamiliar code base.

Good luck!

Paul Morie