Exercises

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.

Find Refactoring Candidates in Docker

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?

Follow Up on Improvements to Rails

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.)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.79.82