
We are in the part of the series where refactorings target mostly the elimination of duplicated code. For now, most solutions will achieve this goal via...
0 replies - 3007 views - 12/28/11 by Giorgio Sironi in Articles

Error codes are mostly a relic of procedural programming: the object-oriented paradigm has introduced exceptions as a first-class mechanism to separate error...
2 replies - 3877 views - 12/19/11 by Giorgio Sironi in Articles

In statically typed languages, each variable must have a minimal type known at compile time. PHP instead, a is dynamic language where variable can contain any...
0 replies - 3362 views - 12/14/11 by Giorgio Sironi in Articles

In the scenario of today, we have a complex constructor: read this definition as anything that does more work than assigning parameters to fields.The solution...
0 replies - 4697 views - 12/12/11 by Giorgio Sironi in Articles

In the scenario we address today, a method is not used from outside a class, or it's called only from a limited set of classes, such as the current inheritance...
0 replies - 3179 views - 12/08/11 by Giorgio Sironi in Articles

A setter for a certain field is present: maybe it's a generated method, or is used for Dependency Injection.However, in the current state of the code, there...
5 replies - 3434 views - 12/06/11 by Giorgio Sironi in Articles

In the scenario of today, two or more parameters are often passed together to a set of similar methods. This happens for example with timing information...
0 replies - 3656 views - 11/30/11 by Giorgio Sironi in Articles

An object Client invokes a method M1, or produces a value in some equivalent way. Then, it passes the result to a new method M2 on the object Server. However,...
0 replies - 3045 views - 11/28/11 by Giorgio Sironi in Articles

In the scenario of today, we are extracting some fields or calculated values from an object, and then calling a method somewhere else by passing them in as...
0 replies - 3442 views - 11/23/11 by Giorgio Sironi in Articles

The refactoring of today breaks up a method into multiple ones: it chops the method in pieces according to the code that is executed in response to one of the...
0 replies - 3185 views - 11/21/11 by Giorgio Sironi in Articles

In the scenario of today, multiple methods executs mostly the same logic: you can see a strong duplication of code between them, or identical delegation...
0 replies - 2939 views - 11/16/11 by Giorgio Sironi in Articles

In the (recurring) scenario of today, a method modifies the state of an object and returns something at the same time. In this case, the method is an hybrid...
0 replies - 3304 views - 11/14/11 by Giorgio Sironi in Articles

As Kent Beck says, all refactoring techniques are bidirectional; in the case of add and remove refactorings, one direction increases the moving parts to face...
0 replies - 3138 views - 11/09/11 by Giorgio Sironi in Articles

In the scenario of today, a method is missing some information to accomplish its responsibility. Usually, it is forced to look up these data into some form of...
0 replies - 2856 views - 11/07/11 by Giorgio Sironi in Articles

Renaming a method, without changing its signature, is a not expensive operation and can give you a great benefit while reasoning about code. Just a change from...
0 replies - 3185 views - 11/02/11 by Giorgio Sironi in Articles