understand source code of a C++ program written by someone else

Discussion in 'C++' started by TCMA, Dec 21, 2004.

  1. TCMA

    TCMA Guest

    I am looking for some tools to help me understand source code of a
    program written in C++ by someone else.
    Are there any non-commercial, open source C or C++ tools to reverse
    engineer C or C++ programs with source codes on linux?
    i.e. It parses any sized C or C++ project to help reverse engineer,
    document, draw UML diagram and understand it and thus maintain it
    better.
    TCMA, Dec 21, 2004
    #1
    1. Advertising

  2. "TCMA" <> wrote in message
    news:...
    > I am looking for some tools to help me understand source code of a
    > program written in C++ by someone else.
    > Are there any non-commercial, open source C or C++ tools to reverse
    > engineer C or C++ programs with source codes on linux?
    > i.e. It parses any sized C or C++ project to help reverse engineer,
    > document, draw UML diagram and understand it and thus maintain it
    > better.

    As a free tool, try doxygen (www.doxygen.com).
    It can generate hyperlinked HTML from source code, class hierarchy
    graphs, called-by lists, and more...

    hth,
    Ivan
    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- e-mail contact form
    Ivan Vecerina, Dec 21, 2004
    #2
    1. Advertising

  3. TCMA wrote:

    > I am looking for some tools to help me understand source code of a
    > program written in C++ by someone else.
    > Are there any non-commercial, open source C or C++ tools to reverse
    > engineer C or C++ programs with source codes on linux?
    > i.e. It parses any sized C or C++ project to help reverse engineer,
    > document, draw UML diagram and understand it and thus maintain it
    > better.


    No.
    There is no tool that can make sense out of nonsense.
    There are programs like Doxygen

    http://www.doxygen.org/

    that will automatically create documentation
    from comments embedded in your source code
    so that you can maintain your code an documentation together.
    E. Robert Tisdale, Dec 21, 2004
    #3
  4. "E. Robert Tisdale" <> wrote in message
    news:cq8bl6$t5d$...
    > TCMA wrote:
    >
    >> I am looking for some tools to help me understand source code of a
    >> program written in C++ by someone else.
    >> Are there any non-commercial, open source C or C++ tools to reverse
    >> engineer C or C++ programs with source codes on linux?
    >> i.e. It parses any sized C or C++ project to help reverse engineer,
    >> document, draw UML diagram and understand it and thus maintain it
    >> better.

    >
    > No.
    > There is no tool that can make sense out of nonsense.
    > There are programs like Doxygen
    >
    > http://www.doxygen.org/
    >
    > that will automatically create documentation
    > from comments embedded in your source code
    > so that you can maintain your code an documentation together.


    Just because this is easily misunderstood, I would like to insist
    that doxygen can generate a lot of useful information, also from
    code that does not contain any (doxygen) comments.
    The output can still include:
    - hyperlinked source code (click an identifier -> shows its definition)
    - header dependencies (includes & included-by graphs)
    - function call dependencies (links to all calls to a function)
    - class hierarchies (graphs, links)
    - index of namespaces, class names, etc...

    There are IDEs that can provide some of the navigation interactively.
    Nevertheless, doxygen generates valuable information (and even more
    once you use doxygen-specific comments), expecially when reviewing
    the structure of a program.


    Regards,
    Ivan
    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
    Ivan Vecerina, Dec 21, 2004
    #4
  5. TCMA

    Howard Guest

    "TCMA" <> wrote in message
    news:...
    >I am looking for some tools to help me understand source code of a
    > program written in C++ by someone else.
    > Are there any non-commercial, open source C or C++ tools to reverse
    > engineer C or C++ programs with source codes on linux?
    > i.e. It parses any sized C or C++ project to help reverse engineer,
    > document, draw UML diagram and understand it and thus maintain it
    > better.


    Some compilers have pretty good class browsers that will help. I'm not sure
    about their ability to format the output for printers...you'd have to check.
    But CodeWarrior (which I use) does a pretty good class tree diagram.

    Rational Rose will do the job of creating UML from source, I think. (But
    it's insanely expensive!)

    Just a little (nit-picky) side note: source code doesn't require "reverse
    engineering", since it's already source code. That term usually means
    taking raw machine code and creating some form of assembler or source code
    from it.

    -Howard
    Howard, Dec 21, 2004
    #5
  6. TCMA

    David Guest

    On Tue, 21 Dec 2004 04:47:35 UTC, (TCMA) wrote:

    > I am looking for some tools to help me understand source code of a
    > program written in C++ by someone else.
    > Are there any non-commercial, open source C or C++ tools to reverse
    > engineer C or C++ programs with source codes on linux?
    > i.e. It parses any sized C or C++ project to help reverse engineer,
    > document, draw UML diagram and understand it and thus maintain it
    > better.


    Any tool that you could acquire would only rearrange the facts
    already laid down in the source you have. Nothing will help you
    get at the meaning of the source until you decide to sit down and
    explore it. It will take time. It took someone else time to
    write it. You weren't there, so you'll have to make up your own
    mental model. It doesn't have to agree with what the source or
    what the original developer had in mind.

    If it is functional, explore the various UI components. What
    does it expose and what was the mental work model the develoer
    laid out? Explore the source. Start at the beginning if you
    can find it. Also explore various components and try to
    understand what they may do. At some point the fragments of
    a large jigsaw puzzle will appear and you'll figure out how the
    the pieces fit together. You may find some parts you want to
    change and others you may want to use later. Only after you've
    understood what is there and what the mental work model is can
    you then use that base to extend the model the way you'd like
    it to be.

    Have fun,

    David
    David, Dec 22, 2004
    #6
  7. "David" <> wrote in message
    news:rOdGr40LMPU3-pn2-BKOZgSmM4dmq@localhost...
    > On Tue, 21 Dec 2004 04:47:35 UTC, (TCMA) wrote:
    >
    >> I am looking for some tools to help me understand source code of a
    >> program written in C++ by someone else.
    >> Are there any non-commercial, open source C or C++ tools to reverse
    >> engineer C or C++ programs with source codes on linux?
    >> i.e. It parses any sized C or C++ project to help reverse engineer,
    >> document, draw UML diagram and understand it and thus maintain it
    >> better.

    >
    > Any tool that you could acquire would only rearrange the facts
    > already laid down in the source you have. Nothing will help you
    > get at the meaning of the source until you decide to sit down and
    > explore it. It will take time. It took someone else time to
    > write it. You weren't there, so you'll have to make up your own
    > mental model. It doesn't have to agree with what the source or
    > what the original developer had in mind.


    I mostly agree with your comment, but the usefulness of a
    code browsing/analysis tool should not be dismissed.

    A good code browser (IDE-integrated or e.g. doxygen-generated)
    does help navigate through the code and connect bits and pieces
    together. Getting an overview of class hierarchies and file
    dependencies also can be invaluable in helping you create a
    mental model of a piece of code.


    > If it is functional, explore the various UI components. What
    > does it expose and what was the mental work model the develoer
    > laid out? Explore the source. Start at the beginning if you
    > can find it. Also explore various components and try to
    > understand what they may do. At some point the fragments of
    > a large jigsaw puzzle will appear and you'll figure out how the
    > the pieces fit together. You may find some parts you want to
    > change and others you may want to use later. Only after you've
    > understood what is there and what the mental work model is can
    > you then use that base to extend the model the way you'd like
    > it to be.


    Just one addition here: using a debugger and stepping through
    code often is a good way to get an understanding of how things
    work.
    Also very important, as you go, is to add comments about the
    design/function of the code you reviewed. Don't let yourself
    or anyone else do this tedious analysis work again.


    Cheers,
    Ivan

    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
    Ivan Vecerina, Dec 22, 2004
    #7
  8. TCMA

    olivier Guest

    "Ivan Vecerina" <> wrote in message news:<cqb7b4$bil$>...


    what about umbrello ?
    olivier, Jan 18, 2005
    #8
  9. "olivier" <> wrote in message
    news:...
    > "Ivan Vecerina" <> wrote in
    > message news:<cqb7b4$bil$>...
    >
    >
    > what about umbrello ?


    Found here: http://uml.sourceforge.net
    I had never tried it. It looks like a nice UML modeler and code generator.
    Thanks, I will look into it.

    However, the original question was about extracting design information
    from existing source code. Umbrello does not seem to have that capability.


    Cheers,
    Ivan
    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
    Ivan Vecerina, Jan 19, 2005
    #9
  10. Joseph Turian, Jan 19, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. walala
    Replies:
    6
    Views:
    1,740
    Marcus Harnisch
    Sep 3, 2003
  2. Leny
    Replies:
    4
    Views:
    469
    Michael Mair
    Jan 11, 2005
  3. Joshua Moore
    Replies:
    8
    Views:
    327
    Old Wolf
    Apr 18, 2007
  4. Replies:
    3
    Views:
    614
  5. C. Ng
    Replies:
    4
    Views:
    127
    Laurent Pointal
    Nov 18, 2013
Loading...

Share This Page