Thread: Tackling large amounts of code?

  1. #1
    PhysicistTurnedProgrammer Cell's Avatar
    Join Date
    Jan 2009
    Location
    New Jersey
    Posts
    72

    Tackling large amounts of code?

    What are some ways in which you guys deal with projects that you have inherited that have a tremendous amount of code across a bunch of different files, with little documentation or comments. I'm talking about code that you did not write, obviously.

    Any tips or old conventions?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Depends a lot on what you are supposed to do with it.

    There are source-browsing tools and tools that can draw various forms of graphics displaying the relationship between functions, data structures, etc, which can help. Source Navigator is one of those, I think.

    Besides that, it's just a case of hard work and general understanding of how the overall software works.

    Edit: There is obviously some benefit of ADDING documentation [in source or external] when you understand how it works.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Yeah, I just complain that the code is obfuscated beyond comprehension and nag my boss until he lets me do a complete rewrite

    Seriously though, there isn't much you can do but try to add documentation as you figure out what the different parts do. There is some code ive run into in the past that was so obfuscated that I just threw it out and rewrote it without even bothering to tell my boss. He about ........ though when the application suddenly ran 3 times faster and I had to explain what I did. Oh, and then they let me go about 6 months later and are now bad-mouthing me to potential employers to the point I removed them from my resume. So the moral of the story is, don't get too worked up about fixing things that are obviously broken, you wont get any consideration for your efforts.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    http://lxr.linux.no/
    Must be pretty good if it can handle the Linux kernel

    http://www.stack.nl/~dimitri/doxygen/
    Perhaps not too hot initially, but if you use it well you can add information as you discover what it all means. Then it's very useful.

    http://sourcenav.berlios.de/
    A more IDE based approach to navigating the source code in various ways.

    http://www.sourceinsight.com/
    If you're working for a company with a budget for such things.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    PhysicistTurnedProgrammer Cell's Avatar
    Join Date
    Jan 2009
    Location
    New Jersey
    Posts
    72
    Thanks for the answers, guys.

    This is actually for a research project at university. This code has been worked on by a few people over a few years and it's not documented at all. Comments are far and few in-between. There is no way I can justify a re-write, but I am taking the advice of going through each line and commenting as much as possible.

    This is sort of a coding nightmare!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. large program code ,please help
    By Ash1981 in forum C Programming
    Replies: 14
    Last Post: 01-30-2006, 06:16 AM
  2. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM