Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

Code refactoring consists of changing the structure of the code without changing its functionality. The term refactoring is currently used by software development industry to refer to this process.

But what about the verb refactor? Does it exist in this context? Can I say, for example:

After two weeks, I finally refactored the code of this library.

or:

Tell the management that we can't work on the spaghetti code like this. We must refactor it first, which will take a few months.

By the way:

  • Microsoft Word spell checker accepts the term refactoring, but considers refactor as a mistake, suggesting refractor, which has nothing to do with refactoring.

  • Wikipedia avoids using the verb refactor and prefers using combined terms as perform refactoring.

  • When searching for pages containing refactor but not refactoring, the first results are either using refactor as a proper name, like a name of a product, or have nothing to do with software development.

  • Other sources are not helpful. Spell checker in Chrome considers refactoring as an invalid word. The same is the case with Google Translate and several other online translators.

share|improve this question
1  
I work in software and refactor is used all the time as a verb to describe the process of simplifying, optimizing, reorganizing, and generally "cleaning up" code. It is certainly technical jargon, but I would not be surprised to see it enter the general vocabulary at least figuratively, given the large number of people who work in the software industry these days. –  Robusto Feb 11 '12 at 15:24
1  
If you can say a word, it exists. (The only question is whether it means something to people that aren't you.) A dictionary is just a snapshot of the known vocabulary at the time it was written; it's not an authority on whether something "is a word". Its only real authority is on known and commonly accepted meanings for the word at the time the dictionary was written. –  cHao Feb 11 '12 at 19:45
    
I think refactoring is the gerund formed from the verb. The actual noun is refactorization, with 1520 written instances in Google Books for the American spelling, plus some more for the British refactorisation. –  FumbleFingers Feb 11 '12 at 21:51
    
If you (still) have not researched enough: google.com/search?q=define+refactor -- Code refactoring is the process of changing a computer program's source code without modifying its external functional behavior in... en.wikipedia.org/wiki/Refactor –  Kris Oct 21 '12 at 11:46
add comment

4 Answers

up vote 10 down vote accepted

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:

enter image description here

share|improve this answer
    
Note the title bar where it says 'CodeRe frac toring'. That is definitely a solecism. –  Mitch Feb 11 '12 at 16:39
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Yes.

The forum insists on 30 characters or I could have left it at that.

share|improve this answer
2  
... if this is your whole answer, and you can't back it up in any way, then what you mean is to comment that you agree with the OP's thought that refactor is an acceptable English verb, but you can't help him back up that thought. –  sq33G Feb 11 '12 at 20:15
    
He asked if there was such a word with such a definition. There is. What more is there to say? I could point him to a Google search or a dictionary. But so what? That's obvious. –  Jay Feb 13 '12 at 16:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.