The following exercises let you uncover technical debt in popular open source projects. You also learn how the combination of hotspots and complexity trends lets you follow up on the improvements you make in the code. That is, instead of focusing on problems, you get to use the analysis techniques to identify code that has been refactored.
Remember the document linked in How Should You Read This Book?, which specifies a single page with all the exercise URLs. It’ll save you from having to type out all URLs in case you’re reading the print version.
Repository: https://github.com/moby/moby
Language: Go
Domain: Docker automates the deployment of applications inside containers that hold everything needed to run the system.
Analysis snapshot: https://codescene.io/projects/169/jobs/3964/results/code/hotspots/system-map
The top hotspot in our case study of ASP.NET Core MVC was a unit test. This is a common finding; we developers tend to make a mental divide between application code (which we know is important to keep clean and easy to maintain) and test code (which often receives considerably less love at code reviews). This is a dangerous fallacy since from a maintenance perspective the test code is at least as important as the application code.
Inspect the hotspots in Docker from the perspective of test automation. Are there any maintenance problems? In what direction does the code evolve? Where would you suggest that we focus improvements?
Repository: https://github.com/rails/rails
Language: Ruby
Domain: Rails is a server-side web application framework built on the model-view-controller pattern.
Analysis snapshot: https://codescene.io/projects/1699/jobs/4265/results/code/hotspots/system-map
We’ve seen how complexity trends gives us more information on how a hotspot evolves. The trends are also great as a follow-up to subsequent improvements. After a large refactoring, perhaps to simplify conditional logic or to extract cohesive modules from the hotspot, we want to ensure that our complexity trend goes down and stays there.
Explore the two frequently changed files, activerecord/lib/active_record/base.rb and activerecord/lib/active_record/associations.rb, that we identified in code. Investigate their trends for signs of successful refactorings. Do either of the files give us a false positive with respect to the hotspot criteria? You get bonus points if you can think of a way to filter out refactored code that is no longer a problem from the hotspot results. (In Chapter 5, The Principles of Code Age, we discuss information that helps us with the task.)
https://codescene.io/projects/1690/jobs/4245/results/code/hotspots/system-map
https://codescene.io/projects/1690/jobs/4245/results/code/hotspots/system-map
https://github.com/adamtornhill/maat-scripts/blob/master/miner/git_complexity_trend.py
3.22.79.82