Tuesday, July 21, 2009

Digging into New Code

One of the biggest challenges in learning a new system is trying to get a picture of that new system as a whole.

Right now I'm trying to learn a pretty complex system, one of the big challenges is that there are so many SLOC that simply opening a file and poking around won't do you any good.

So the question becomes this:
How does one become knowledgeable on a particular system and how do they find that starting point?
I think this question applies to projects big and small. If you don't know where to start, you will continually find yourself asking the more experienced programmers where to begin.You might even be able to modify small portions of code to do what you want and that works as long as those developers are there to point you in the direction, but when the time comes (and it will) that they aren't there, you have to be able to figure it out yourself.

So back to our question, HOW do you do that.

Of course the simple answer is start at the beginning and READ the code as it progresses, and that is an acceptable answer in a lot of situations.

In other situations it's not so easy, some systems are real time embedded systems, so you'll then have to figure out when you enter your frame again, do you start at the beginning, where you left off, or in a predetermined location?

Here's some questions to ask yourself when you are just starting to look at an entire system:
  1. Where do you start and can your program be interrupted,
    • If your program can be interrupted, how is it handled, like I mention above where does it start again when it's given control again.

  2. What is your program trying to accomplish in this section of code that you're reading
    • How does it pertain to the project as a whole.

  3. Can you break the code into groups, I.E.
    • If your project is a car, can you break it into sections such as brakes, engine, steering?

  4. Create a list of all pieces (if possible) that make up each group.
    • Look at how they each contribute to the whole.

  5. Does each group interact with another group directly or is there a common group that handles all requests to each group?
    • Make a web chart that connects each group and primary methods of communication between each of them.
Let me know if you have any suggestions as to how to learn and understand large projects that you didn't code yourself.

No comments:

Post a Comment