The article presents answers to the questions asked to Issam Lahlali that concern the developer tool CppDepend.
In this article, you will read an interview with one of the developers of the CppDepend tool for analyzing software product structure.
The questions are asked by (the questions are in bold):
Andrey Nikolaevich Karpov. One of the founders of the "Program Verification Systems" company. Participates in development of the PVS-Studio package intended for detecting defects in application source code.
The questions are answered by:
Issam Lahlali. One of the developers of the CppDepend and VBDepend packages.
I'm Issam Lahlali, MCSD and MCSD.NET certified, I worked with several software editors in rance, my last job was in Sophis as software architect. Two years ago, I had the oportunity to meet Patrick Smacchia, the developer of NDepend, and he convinced me to work in partnership with his company to develop CppDepend and VBDepend.
CppDepend is a tool for C++ developers and architects. Code bases are very complex things and CppDepend is a tool that helps get information from the source code.
For example, with CppDepend, knowing if your code base is correctly layered, knowing what has changed since the last release or assessing the code quality represent some immediate tasks that might take hours or days with traditional tools.
CppDepend complements other static analysis tools, it focus more on architecture and design rather than implementation like other tools. With CppDepend, we have a deep view of coupling, cohesion, abstractness, instability and so on.
First, download CppDepend and analyze your code base. Once the analysis done, the VisualCppDepend UI displays several panels to browse analysis results.
At this point, the user needs to choose if he wants to browse dependencies, browse metrics, query the code base with the CQL language, compare 2 analyses etc... More or less, each feature has its dedicated panel.
There is also an embedded help section that contains some 'Getting Started' explanations. Some screencasts are also linked. They explain how to achieve each particular task.
Finally, our website contains advanced documentation such as the complete CQL specifications.
Personally I use the matrix every day to browse dependencies and make sure the architecture remains clean.
I am also addict to the comparison feature. I often use it to review code that is changing. I really believe that the devil lies in changes. CQL is also very useful to query the code base, it adds more flexibility to CppDepend.
CppDepend is all about understanding and controlling what really happens in your development shop. The idea is to fetch relevant information from the code itself.
The tool has 2 sides: The Visual side where the VisualCppDepend UI lets you analyze live your code base, with graph, matrix, metrics panel. These visual panels with dependency graph, matrix and metric treemap, help a lot churning the code.
VisualCppDepend comes also with Code Query Language CQL. CQL is really at the heart of the product. CQL is to your code what SQL is to your data.
You can ask, for example, which method has more than 30 lines of code by writing the CQL query:
SELECT METHODS WHERE NbLinesOfCode > 30
And if you want to be warned of such big methods, you can transform this CQL query into a CQL rule this way:
WARN IF Count > 0 IN SELECT METHODS WHERE NbLinesOfCode > 30
CQL covers a wide range of possibilities, from 60 code metrics to dependencies, encapsulation, mutability, code changes/diff/evolution.
For example, asking for methods that have been changed recently is as easy as writing:
SELECT METHODS WHERE CodeWasChanged
CppDepend comes with more than 100 rules by default and you can modify existing rules and add new rules at whim to fit your needs.
The other side of CppDepend is its integration into the Continuous Integration/Build server process. The idea is to get a daily and highly customized HTML report where you can see at a glance if some CQL rules have been violated and to get also some metrics about quality or structuring. This is how one can master what is really happening in one's development shop.
For parser we adapt doxygen parser to our needs. doxygen is open source, so our modified parser named CppDependency is also open source, and is available from SourceForge website. CQL engine and UI are developed with DotNet technology.
We used DotNet technology, so it works only on Windows machine. We plan to adapt our software to work with Mono. But with CppDepend we can analyze any C++ project - the drawback of analyzing C++ project existing in Linux or Mac machine is that we have to copy the source code to Windows machine.