|
Strong Studio partnership
DevPartner Studio Professional Edition 8.1.
By Mike James
Published: 26 August 2006
Perhaps the most complimentary thing you can say about any optional extra, of any kind, is that you miss it when it’s gone. This is true of Compuware’s DevPartner, and I for one wonder what’s happened when I have to use a version of Visual Studio that doesn’t have it installed.
I’ve reviewed the product before, but the latest version has some new features that I haven’t previously commented on. First, just in case you don’t already know DevPartner, I’ll give you a “nutshell” overview.
Quality integration
What DevPartner is all about is code quality. It is composed of a number of modules, but they all reinforce the idea of code quality and they fit together well. It’s also worth saying at this early stage that DevPartner integrates with Visual Studio so well that you really do start to think that it is part of the standard facilities, and hence can feel somewhat lost and confused when you have to use a system without it.
It has five main roles:
1. Code review
Even if you are a disciplined programmer, you will still benefit from the source code review or static code analysis that it provides. A set of pre-defined code rules is used by default, and in most cases you won’t need to add or modify these very much unless you already have a custom in-house coding style book. The analysis covers C#, VB.NET and ASP.NET, and you can use it in a mixed language project. It is always an eye-opener to run an analysis on a piece of code that you are proud of, only to discover how many bad coding habits you have. Of course, considering the result of a code review is an education in itself. When working in a team you can apply the same coding standards across the entire project and on every team member.
Using code review is just a matter of selecting the menu item. After a short wait you are presented with a list of possible problems. Each problem is explained in terms that allow you to consider its impact. A simple example is supplied that shows you, usually in one or two lines of code, how to correct the problem. Many of the rules deal with potential security problems and performance issues. You are also shown any .NET naming violations, complete with suggested changes, code metrics and a very pretty call graph that makes understanding code relationships easy.

At last – an easy to understand call tree
The latest version has the ability to exclude areas from review, plus better, easier custom rule creation, 21 new code rules, and better batch support for automating reviews.
2. Runtime Analysis
There is only so much that static analysis can tell you, and many think that DevPartner’s smart debugging is the real gold. With the standard debugger you only notice a problem if the program crashes or throws an exception. With smart debugging DevPartner looks out for problems that might not have caused a crash or exception, yet but do so in the future. It looks out for bad API and system calls, and tracks transitions between managed and unmanaged code. Specialist options such as deadlock analysis and COM object tracking have to be turned on if you think you need them. If you are notified of a problem, clicking on the report takes you to the line in the code that is the likely cause of the problem.
3. Memory Analysis
Memory analysis is more than just checking for leaks (something that isn’t supposed to happen in .NET but does), it is also concerned with letting you know what is using space. It gives you an easy-to-interpret report on what classes are occupying what memory. A real-time graph shows the way memory allocation changes dynamically as the application runs. You can also view the contents of the heap dynamically, and view a list of classes and their memory use. As it is really a system task, memory analysis works on almost any .NET language including C#, VB.NET, VC++, ASP.NET and JScript, and it works with mixed language projects.
4. Coverage analysis
It’s a simple idea – make sure that all the code was actually tested. Coverage analysis does just this by tracking the results of testing sessions. It pinpoints any code portions that haven’t been exercised. Notice that this doesn’t impose any testing strategy or philosophy on you. With a Studio Server licence you can extend code coverage to include work performed on remote machines.
5. Performance Analysis
We all know that it’s 1% of the code that takes 99% of the execution time, but which 1%? You can attempt to find inefficient code by a mixture of intelligent guesswork and custom instrumented code, or alternatively DevPartner can just do the job for you. You run a performance analysis and DevPartner shows you clearly how much execution time everything is taking down to an individual line of code. You can view your source code annotated line by with the time and percentage time the line was executed. You can also see the top 20 methods and how much time was spent in system methods and calls. Even if it does turn out that your application spends most of its time executing system code, you can still use this information to optimise it.
New in version 8.1 is the Performance Expert. This is an alternative way of investigating performance in terms of CPU/thread usage, disk I/O, network I/O, and any synchronisation wait time, all of which are displayed on a real-time chart as the program runs. When the application stops cumulative charts are presented, and you can again view code annotated by any of the performance measures.
The only conclusion that you can come to after seeing what DevPartner can provide by way of performance information is that if you can’t find the problem and fix it, then you probably need a new algorithm.
Fault Simulator SE
It can be surprisingly difficult to make errors occur during testing – even if they do seem to occur easily in the field. Fault Simulator SE was introduced in version 8.0, and it can be used to set up error conditions in the .NET framework. The program is then run and you can gather information on its behaviour and how well it handles the error state. You can set .NET error conditions by right-clicking on a statement that uses a framework method and set the error condition to specify “directory not found”, “access denied”, etc. When the instruction is executed the error condition is simulated and you can see what happens. This is so much quicker than actually setting up the conditions that it means that you probably will do the tests rather than just hope. As its name suggests, Fault Simulator SE is a cut-down version of the full product, and the most notable omission is the ability to simulate environment faults such as low disk space, network errors, registry errors and so on. It could well be worth upgrading to get the full functionality of this very handy utility.
New and notable
The System Comparison utility was introduced in version 8.0, but it is still relatively new. What it does is take snapshots of the entire system configuration. The real usefulness of this is that you can automatically compare machine configurations in an attempt to pin down differences in behaviour. New in 8.1 is the System Snapshot SDK, which you can use to build Snapshot capabilities into your application royalty-free. You can configure it to only record information that you think relevant and add custom information by writing a plug-in. You can trigger the Snapshot when your application encounters a problem and transfer it to you for analysis by the comparison tool.

See how the memory grows and where it goes!
Also new in 8.1 is integration with Visual Studio Team Foundation Server (VSTFS). This is a logical step. You can submit defect work items directly from DevPartner to VSTFS, and this makes DevPartner a team player and not just your personal helper. For the complete team player however you probably need the Enterprise Edition, which handles requirement tracking, workflow management, and defect tracking for a team.
It is worth adding that DevPartner still supports Visual Studio 2003 and Visual C++ 6, and there is also a Java edition. You can view a demonstration and download a trial version from the Compuware web site, and if you are interested in improving code quality this is your best next step. There are many features of DevPartner that I haven’t had space to go into, but the main point is that it is easy to use and delivers on the promise to make your code better with minimal extra work on your part.
Before DevPartner you needed a trusted and very intelligent colleague to review your code and point out where you might improve its efficiency, suggest likely bugs, and so on. Now you can just use DevPartner. It really should be standard issue for any Visual Studio user.
Compuware UK, 01753 444 000
Return to Articles
|