Archive

Posts Tagged ‘Changing Signatures’

Refactorings for changing member signatures overview

August 9th, 2012 Comments off

This is just a quick list to organize a bunch of refactorings that change member signatures. Click the refactoring name to learn more about it.

Add Parameter

The refactoring adds a new parameter to a method declaration and updates all calls accordingly. This refactoring is useful when you need to quickly add a new parameter to an existing method because it needs more information from its caller that wasn’t passed in before.

Read more…

Changing Signatures Refactorings – Convert to Tuple

May 19th, 2011 Comments off

The Convert to Tuple refactoring shipped in Refactor! Pro is similar to the Introduce Parameter Object refactoring, but it doesn’t create a new object – it uses the built-in .NET Framework 4.0 Tuple object.

Read more…

Refactorings – Introduce Parameter Object

August 13th, 2010 Comments off

The Introduce Parameter Object refactoring consolidates selected parameters into single object. If you frequently need to pass similar sets of values to methods that tend to be passed together, it might be useful to encapsulate these values into an object that carries all of this data. It is worthwhile to turn these parameters into objects just to group the data together. As the result, calling statements will become more compact and you will be able to add data processing logic to the newly declared object. This refactoring is also useful because it reduces the size of the parameter lists, and long parameter lists are hard to read and understand.

Read more…

Refactorings – Remove Parameter

August 13th, 2010 Comments off

Also known as Remove Unused Parameter. This refactoring removes an unused parameter from a method declaration, and updates all calls accordingly. It is very useful when a parameter is no longer used by the method body. A spurious parameter doesn’t cause any problems, and you probably might need it again later. But most of the time this is the wrong choice, because a parameter indicates information that is needed. In this case, a caller has to worry about what values to pass for a fictitious, unused parameter. By not removing the parameter you are making further work for everyone who uses the method.

Read more…

Refactorings – Add Parameter

August 13th, 2010 Comments off

The refactoring adds a new parameter to a method declaration and updates all calls accordingly. This refactoring is useful when you need to quickly add a new parameter to an existing method because it needs more information from its caller that wasn’t passed in before. Bear in mind that if there are alternatives available against doing this refactoring, it is preferred to use those alternatives instead, because they don’t lead to increasing the length of parameters lists. Long parameter lists are hard to remember and often involve data clumps.

Read more…