Introduce Parameter Object

This is provided by some tools - Resharper has ‘Transform Parameters’, IntelliJ has ‘Introduce Parameter Object’. If you don’t have this available, then this checklist will help you to do it with only Extract Method and Inline Method.

Identify

In a long parameter list, some might usefully be grouped together into a new class.

Prepare

Work out which parameters you want to group together into a new class and ideally think of a good name for it.

Implement

Clear

Check the name of the new method is the same as the original.

Follow up

Often you want to move the method to the type you just created.

Prompted by Code Smells

Relevant Learning Hours

Sources

Back to All Refactorings