A common refactoring in object-oriented programming is to take a complex method or set of methods and extract a new class from them. These classes — often referred to as “service objects” or “operations” — allow you to break a complex operation into small well-named components as private methods. And because classes can hold state in instance variables, you no longer need to pass state around through the use of method arguments.
Sitting Ducks
Sitting Ducks
Sitting Ducks
A common refactoring in object-oriented programming is to take a complex method or set of methods and extract a new class from them. These classes — often referred to as “service objects” or “operations” — allow you to break a complex operation into small well-named components as private methods. And because classes can hold state in instance variables, you no longer need to pass state around through the use of method arguments.