Is there a verb "refactor" meaning "doing refactoring" in English?
Solution 1:
This is most likely a case of dictionaries having not caught up with an industry's lingo or jargon. Here are a few examples of using refactor:
You can also refactor other things besides formal expression languages. Like DocumentRefactoring. I refactored this definition several times in order to group similar ideas into their related paragraphs. Of course, I call that reorganization. It's all similar (except where it's different). (source)
Refactor mercilessly to keep the design simple as you go and to avoid needless clutter and complexity. (source)
For example, if a programmer wants to add new functionality to a program, he may decide to refactor the program first to simplify the addition of new functionality in order to prevent software entropy. (source)
These examples were found with ten minutes of searching.
In addition to the above, my own personal experience around programmers suggests that every single programmer who knows what refactoring is will understand what refactor means. Furthermore, Visual Studio's refactoring menu actually calls it refactor:
Solution 2:
Yes, refactor is the verb. This is actually elementary English grammar: refactoring is nothing more than the gerund (noun form) of the verb refactor, formed by adding the suffix -ing. In other words, refactor came first, and refactoring derives from it.
Solution 3:
It comes from the prefix re
+ the verb factor
, from the mathematical sense of the verb. When you factor an expression in mathematics, you change its structure without changing its value, e.g. x^2 - y^2 = (x + y) * (x - y)
or 6x = 2 * 3 * x
, either to express it more simply or to expand upon it so it is easier to do work upon it.
So, let's say you have 20x
, which I'll say represents the total intended functionality of the program, since you need to break down the total functionality into discrete parts which function together. You could factor that to 2 * 10 * x
, which I'll say represents the initial coding. However, that's not as simple as it could be, so it could be refactored into 2 * 2 * 5 * x
which represents the refactored and simplified code.
In a program itself, lets say you have two functions which repeat several bits of code between them, like lets say they both contain the code necessary to open a database connection and query the database for whatever information they need. This is like the 10
in 2 * 10 * x
. So, you refactor that code out of each function and into its own function which the other functions call rather than repeating the code twice over.