[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] How to Analyze/Study Source Code?



On Wed, Jul 16, 2008 at 5:57 PM, Amit Uttamchandani
<auttamchandani@canoga.com> wrote:
> Hey everyone,
>
> Just wondering how you guys go about studying code? Do you read every
> single source file and then make notes? Or is there a tool that goes
> about and draws out relationships between source code files?
>
> I ask this because I am looking into adding a feature/fix to pcmanfm
> but it looks like its going to take me a while to understand how
> everything works together.

I generally start by reading the documentation that comes with it,
including files like HACKING and TODO.  Then I read the Makefile and
run etags to generate a symbol index.  Then I try to understand the
particular bit of the program I'm proposing to work on.  Frequently
reading the code is enough.  If not though, I often use strace to "see
through" the code to what the program actually does.   While I know
about cflow, I rarely use it.

It's not uncommon for me to want to patch a program, but in general
50% of the total time I spend doing that is occupied with finding the
source repository, checking the code out and making it build.
Actually understanding the code, changing it and testing the result
takes only about half the total time.

James.


Reply to: