|
Version 1.2 |
Top Previous Next |
|
Version 1.2 Localize Module Variables: This refactoring analyzes the way that private module-level variables are referenced,determines the optimum scope of each private module-level variable based on its usage within the module, and lets you customize and execute any/all the variable moves with great ease.
Localize Module Variables is not an officially-catalogued refactoring, so far as this author knows, but it meets the definition of a refactoring: it should not change the behavior of your code. Here's how it works:
This is a great tool for simplifying the structure of a module, especially if "the last programmer" wasn't too careful about encapsulation. It is also can be useful after you've made significant changes to a module - if you've deleted or consolidated several routines, for instance, you may now have one or more module-level variables that can be "localized." If a private module-level variable isn't referenced in code, then the suggestion is to delete it; if it is referenced by only one routine, then the suggestion is to move it into the routine that references it. If it is referenced by more than one routine, then it is left alone. The interface allows you to control the process variable-by-variable:
A greatly improved interface for Extract Method:
Introduce Explaining Variable can be used to create a module-level explaining variable, not just a local as in Version 1.1.
There were a number of miscellaneous bug fixes.
|