sud03r
sud03r

Reputation: 19749

How to start modification with big projects


I have to do enhancements to an existing C++ project with above 100k lines of code.
My question is How and where to start with such projects ?
The problem increases further if the code is not well documented. Are there any automated tools for studying code flow with large projects?

Thanx,

Upvotes: 8

Views: 593

Answers (10)

Soo Wei Tan
Soo Wei Tan

Reputation: 3371

Running Doxygen with the EXTRACT_ALL tag set to document all the relationships in the code base. It's not going to help you with the code flow, but hopefully it will shed some light with regards to the structure and design of the entire application.

Upvotes: 2

Dan
Dan

Reputation: 10393

First thing I would do is try to find the product's requirements.

It's almost unthinkable that a product of this size would be developed without requirements.

By perusing the requirements, you'll be able to:

  • get a sense of what the product (and hence the code) is at least supposed to be doing
  • see just how well (or poorly) the code actually fulfills those requirements

Otherwise you're just looking at code, trying to divine the intention of the developers...

Upvotes: 3

user118861
user118861

Reputation:

A very good austrian programmer once told me that in order to understand a program you first have to understand the data-structures that the program uses.

Upvotes: 1

Steve Rowe
Steve Rowe

Reputation: 19413

The first thing you need to do is understand how the code works. Read what documentation there is and then watch the program operate under a debugger. If you watch the main function/loop and then slowly work your way deeper into the program, you can gain a pretty good idea how things are operating. Make sure you write down your findings so others who follow after you have a better position to start from.

Upvotes: 2

dmeister
dmeister

Reputation: 35604

The book "Code Reading" by Diomidis Spinellis contains lots of advice about how to gain an overview and in-depth knowledge about larger, unknown projects.

Chapter 6 is focuses sonely on that topic (Tacking Large Projects). Also the chapters about tooling (Ch. 9) and architecture (Ch. 8) might contain nice hints for you.

However, the book is about understanding (by reading) the "code". It does not tackle directly the maintenance step.

Upvotes: 3

Michael Zilbermann
Michael Zilbermann

Reputation: 1428

There is another good book, currently freely available on the net, about object oriented reengineering : http://www.iam.unibe.ch/~scg/OORP/

Upvotes: 3

piotr
piotr

Reputation: 5787

If you are able to run the code in a PC, you can try to build a callgraph usually from a profiling output.

Also cross referencing tools like cscope, ctags, lxr, etc. Can help a lot. A

Spending some time reading, building class diagrams or even adding comments to the parts of the code you took long to understand are steps towards getting familiar with the codebase and getting ready to modify/extend it.

Upvotes: 2

Alan Haggai Alavi
Alan Haggai Alavi

Reputation: 74202

  • First study the existing interface well.
  • Write tests if they are absent, or expand already written ones.
  • Modify the source code.
  • Run tests to check if the modification somehow breaks the older behaviour.

Upvotes: 3

Nader Shirazie
Nader Shirazie

Reputation: 10776

There's a book for you: Working Effectively with Legacy Code

It's not about tools, but about various approaches, processes and techniques you can use to better understand and make changes to the code. It is even written from a mostly C++ perspective.

Upvotes: 13

Khaled Alshaya
Khaled Alshaya

Reputation: 96849

Use Source Control before you touch anything!

Upvotes: 16

Related Questions