Rename Method is a refactoring that changes a name of a method into a new one, that better reveals its purpose.
To have clearer, more understandable code, programmers would optimally want to change method names to reflect exactly what the method does. For example:
public int foo(int x){ return x+1; }would be better renamed as:
public int addOneTo(int x){ return x+1; }The function operates the same, but is now more easily readable for developers looking through the code. Note that in some cases there is little necessity for documentation of a simple function if the function or variable name is correct. In these cases the documentation is redundant and may be confusing as it may not match the variable or function name - leading the developer to be unsure as to which (the name or the documentation) is correct. Martin Fowler lists this as one of his refactorings at refactoring.com.
Read more about Rename Method: Take Care
Famous quotes containing the word method:
“The method of painting is the natural growth out of a need. I want to express my feelings rather than illustrate them. Technique is just a means of arriving at a statement.... I can control the flow of paint: there is no accident, just as there is no beginning and no end.”
—Jackson Pollock (19121956)