Archive

Archive for the ‘Refactorings’ Category

Refactorings – Decompose Parameter

September 9th, 2011 Comments off

The Decompose Parameter refactoring splits a single parameter into one or more parameters, depending on the function of the original parameter. The refactoring analyzes how the parameter is used and which of its properties are accessed, after which it can replace a single parameter into several others of the appropriate type for each property being accessed through the original parameter.

Read more…

Refactorings that work with strings – Use StringBuilder

August 31st, 2011 Comments off

In addition to the refactorings that work with the concatenated strings and the String.Format call, there is another useful refactoring called Use StringBuilder. This refactoring replaces the string concatenation operations with corresponding methods of the StringBuilder class.

Read more…

String.Format-specific refactorings shipped in Refactor! Pro

August 31st, 2011 Comments off

Refactor! Pro provides several refactorings to create and organize the .NET String.Format call. The String.Format call is a static method that receives a string that specifies where the following arguments should be inserted, and how they should be formatted. You can specify the display options for each argument individually using the String.Format call.

Read more…

Refactorings for C++: moving methods to source file and back to the header

July 29th, 2011 Comments off

There are two refactorings specific to the C++ language:

  • Move Method to Source File
  • Move Method to Header

Read more…

Refactorings specific to auto-implemented properties

July 12th, 2011 Comments off

Auto-implemented properties enable you to quickly specify a property without having to write logic for the property accessors. The auto-property’s logic and the field serving as a backing store are automatically generated by the compiler. Such properties appeared in C# version 3.0 and Visual Basic version 10.0.

Read more…

Refactorings – Use Implicit Line Continuation

June 30th, 2011 Comments off

The Use Implicit Line Continuation is a Visual Basic language specific refactoring available in Visual Studio 2010 that removes redundant line-continuation underscore characters from an entire source file.

Visual Basic language version 10 has been improved in the area of line-continuation characters. Now, there are a lot of places in the code where an underscore is not necessary anymore, which means that Visual Basic is smarter about auto-detecting line continuation scenarios, and as a result, no longer expect you to explicitly indicate that the statement continues on the next code line. For example, the underscore is no longer necessary in the following cases:

Read more…

Refactorings – Convert to Point

June 28th, 2011 Comments off

The Convert to Point refactoring is based on the Introduce Parameter Object refactoring with the difference that it doesn’t create a new object for parameters. Instead, it uses a ‘Point’ structure when there is a pair of two numeric parameters of a method definition are selected.

Read more…

Refactorings – Use Named Arguments

June 28th, 2011 Comments off

Named Arguments is a feature of the C# and Visual Basic languages introduced in the .NET Framework version 4.0. Named arguments allow you to explicitly specify a name for an argument for a particular parameter by associating the argument with the parameter’s name, rather than with the parameter’s position in the parameter list. Using named arguments frees you from the need to remember or to look up the order of parameters in the parameter lists of called methods.

Read more…