Refactoring
where to start?Composing Methods
A large part of refactoring is composing methods to package code properly. Almost all the time the problems come from methods that are too long. Long methods are troublesome because they often contain lots of information, which gets buried by the complex logic that usually gets dragged in.
Moving Features Between Objects
One of the most fundamental, if not the fundamental, decision in object design is deciding where to put responsibilities. So, this set of refactorings is all about object’s responsibilities.
Organizing Data
In this chapter we’ll discuss several refactorings that make working with data easier.
Simplifying Conditional Expressions
Conditional logic has a way of getting tricky, so here are a number of refactorings you can use to simplify it.
Making Method Calls Simpler
Objects are all about interfaces. Coming up with interfaces that are easy to understand and use is a key skill in developing good object-oriented software. This chapter explores refactorings that make interfaces more straightforward.
Dealing with Generalization
Generalization produces its own batch of refactorings, mostly dealing with moving methods around a hierarchy of inheritance.
Big Refactorings
The preceding chapters present the individual “moves” of refactoring. What is missing is a sense of the whole “game.” You are refactoring to some purpose, not just to avoid making progress (at least usually you are refactoring to some purpose). What does the whole game look like?
1
Start from learning general refactoring concepts…2
…than, proceed to list of common problems…3
…and learn all refactorings one by one.
|
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License |
