SPA Conference session: Scalable .NET Design Reviews through Automated Analysis | |||
| One-line description: | Using automated code analysis to provide high quality, high frequency design quality feedback | ||
| Session format: | Tutorial (75 mins) [read about the different session types] | ||
| Abstract: | In evolutionary, feedback-driven approaches to design and architecture, we can expect the designs that emerge to be only as good as the standards we set and enforce for code quality. The sooner design problems can be detected, the easier they can be fixed through ongoing refactoring. Just as it is with functional test assurance, we quickly meet the practical limitations of manual design quality checking. Covering large amounts of code whilst searching for dozens of potential code smells is extremely labour intensive. Unsurprisingly, teams find that the effort and expense is too great, and even less surprisingly, the lack of design quality assurance soon becomes apparent in the quality of the emerging code. Our experiences with Test-driven Development have taught us the profoundly positive impact of having suites of automated regression tests that can cover our codebase in a tiny, tiny fraction of the time it would take to achieve the same coverage manually. Experiences with automated design quality checking suggests similar benefits can be reaped using tools like NDepend, Simian, Mono.Cecil, FxCop and similar. In this tutorial, I will review a 100,000+ line .NET code base (using NDepend for illustrative purposes), searching for a range of common code quality problems and constructing a refactoring "TO DO" list that can be prioritised and scheduled accordingly. I will then demonstrate how my automated review can be incorporated into an automated build process so that design quality checks can be run as routinely as developers run their build scripts. | ||
| Audience background: | Anyone who can follow C# and has an understanding of the .NET architecture. Familiarity with code smells and refactoring helpful. | ||
| Benefits of participating: | An understanding of how to use code analysis tools like NDepend to detect a range of common design problems, and an appreciation of how these techniques could help deliver higher quality, more maintainable code at lower overall costs. | ||
| Materials provided: | A community edition of NDepend on disks/USB keys, plus example source projects - with NUnit test coverage reports - to practice on. (And my own laptop, obviously!) NB: NDepend is a commercial product - with a free version for strictly non-commercial use. I am not affiliated with this product (though I am a heavy user of the tool.) | ||
| Process: | I'll start with a short overview to explain what I'm about to demonstrate, focusing on the benefits of the techniques. I'll then ask participants to group into pairs. I will demonstrate how to detect a very simple code smell using NDepend - e.g., long methods. The pairs will do the same on their own laptops. I will then demonstrate searching for 2 more common code quality problems, increasing in sophistication (the last one being looking for complex, untested and highly depended-upon methods) Finally, I'll show how to drive NDepend analysis from a NAnt build script and how to fail a build if quality standards aren't satisfied. While the audience works through the examples, we will also discuss some of the wider issues surrounding automated code quality analysis, such as the risk of false positives, organisational and managerial abuses of the outputs of analysis, and the current vagueness and lack of wide agreement on the exact meaning of many design principles and code "smells". | ||
| Detailed timetable: | 00:00 - 00:10 Explanation/Intro 00:10 - 00:30 Example One - Long Methods 00:30 - 00:40 Example Two - Excessive Coupling To Concrete Classes 00:40 - 00:50 Example Three - High Risk, Untested Code 00:50 - 01:05 Incorporating NDepend Analysis in a Build Script 01:05 - 01:15 Q&A & Discussion | ||
| Outputs: | Web Page with: * Slides * Video Capture of desktop w/ audio (I'll bring a mic) | ||
| History: | |||
| Presenters | |||
| 1. Jason Gorman parlezuml.com |
2. | 3. | |