Chapter 7. Common restructuring patterns

 

This chapter covers

  • Patterns for drawing Mikado Graphs
  • Patterns for moving code around
  • Some tricks for changing code

Your Mikado Graphs will likely never be exactly the same, but often you’ll get the feeling that you’ve seen something similar before, or that you’re doing a chain of refactorings you’ve done previously. When you see such a form recurring or see yourself repeating almost the same thing you did last week, it’s possibly a pattern. We call them patterns because they’re more or less prepackaged solutions that can be applied to similar situations. With a little bit of mapping to your problem domain, patterns are good tools to have in your toolbox.

The patterns included in this book are ones that have helped us; they’re not by any means an exhaustive list. We encourage you to observe your behavior when it comes to restructuring and programming and to find your own patterns.

In this chapter, we’ll show you some patterns for moving and grouping code that’s been scattered in different packages in a codebase, a central task when working with legacy code. In addition, we’ll show you some code tricks we’ve used. But we’ll start out easy with some graph patterns for drawing clearer graphs.

7.1. Graph patterns

 
 

7.2. Scattered-code patterns

 
 
 
 

7.3. Code tricks

 
 

7.4. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage