Once you get past “10 PRINT ‘HELLO WORLD'”, programs start to get complicated. Modern projects in object oriented languages can span hundreds of files of code, and getting a grip on the entire structure of your program and how any part relates to any other part can be difficult or impossible. CppDepend (various pricing, free feature-limited pricing) is a powerful source analysis tool that offers C++ programmers help with this problem.
To use CppDepend, you simply fire it up and point it at your project files. CppDepend will open a wide range of project formats, including .build, .sln, and .vcproj. Once you’ve got all your digital ducks in a row, you press the “analyze” button, sit back, and fairly soon (depending on the size of your project) you’ve got an analysis.
The default analysis for CppDepend includes a considerable number of metrics, many of which I’ve never thought about. In addition to straightforward items such as the number of lines of code in a function, CppDepend calculates such things as efferent and afferent coupling (how many items an object depends on or depend on it) for types, classes, and field, and cyclomatic complexity (how many decision points are in a function). In addition to all this, CppDepend comes with a query language, a variant of SQL, which allows you to define things to look for.
Since it produces a tremendous amount of information, it is no surprise that the CppDepend interface is very complicated, with many tabs, windows, and reports. The good part of this is that you don’t need to drill down through ten dialogs to find something out. The bad part is that CppDepend indulges in two sins, one venal, the other mortal.
The first sin is that of surprising the user. “The path of least astonishment” is the best model for interface design, and CppDepend does not follow it. Often, clicking an item or value in the main interface will fire up your default Web browser to display the result. There’s no reason to enlist Firefox to perform the kind of straightforward rendering these reports require.
The second sin, a more serious one, is in the Trial version’s deportment. It constantly reminds you it’s a trial version by leaving buttons and options seemingly enabled and then responding with pop-ups telling you this feature is not available in the trial. Sometimes, this happens very unexpectedly–I was using a feature which allowed me to drill down to show dependencies between code modules, and after 7 clicks, CppDepend reset to the default view with a message that the trial only supports adjusting the grid 7 times in a row.I appreciate that the goal of a trial is to encourage users to upgrade, but time-limited, fully-functional trials are infinitely superior to feature-limited demos, and double-infinitely superior to feature-limited demos that ambush you with those limits.
CppDepend is not really aimed at the single programmer or hobbyist market. Its feature set, and price, make it best suited for large projects with multiple developers. If you are a developer or manager of such a project–and can deal with the constant dialogs alerting you to features you’re not allowed to use–the demo version is worth a download and run.
Note: The $679 listed price is for a single license; the price per license decreases as more licenses are bought. The trial/demo version lists only the top 10 items that meet a test condition, limits how often you can drill down in the dependency graph, and has many other restrictions.