tags:

views:

354

answers:

14

When a piece of code is commented we say just that, it's "commented out". But when it's not commented out, what is that?

Uncommented isn't quite the same. Active? It's definitely not commented in.

+21  A: 

I call code which isn't "commented out" simply "code"

DarkSquid
But, does code not include comments?
Ollie Saunders
Sure, but code with comments is not the same thing as "commented-out-code". In my view the "default" state is "code" -- after commenting it out it becomes "commented-out-code"
DarkSquid
I agree, it's code. Code does not include comments. That's why you call code with comments "Commented code". Because the Comments and the code are different things. Code generates instructions the computer can run, comments cannot.
Mystere Man
+10  A: 

Uncommented is the most common word for that.

User
+1Also, in popular IDE's the verbs for commenting out and the opposite, are usually given as "Comment" and "Uncomment", so add a past tense to these and you get "commented" and "uncommented".
maxwellb
+2  A: 

It's just a piece of un-out-commented, un-disabled, un-erased, un-inactivated, un-unused, un-deprecated, un-obsolete, un-rewritten, un-archived code.

Or, in layman's terms, code.

Guffa
+1  A: 

A couple possibilities:

  • Live code
  • Legacy code
JB King
+2  A: 

Think of an editorial document. Its kind of like saying "what is the un-deleted writing called?" Just, the writing.

bobobobo
+1  A: 

Visual Studio has a function called "Comment out the selected lines".

The opposite function is called "Uncomment the selected lines". I use the term "uncommented."

Robert Cartaino
Assuming MS and Visual Studio is the "code authority" :)
JTA
+1  A: 

Although it is widely used to refer to 'live' code, 'Uncommented code' is an ambiguous term. It could refer to code that was once commented out, but has been edited to allow it to be run, or it could refer to code that has no descriptive comments.

akf
A: 

I call commented out code...poor code. If it is to be commented out then just toss it all together. Your version control system should keep track of the various states of your previous work. Rather than commenting it out for others to figure out why it was commented out later doesn't seem to be a good coding practice!

Andrew Siemer
To an extent, I agree with you with you, the exception that comes to mind though is commenting out things whilst debugging.
Ollie Saunders
So "not necessarily poor code" would be the other stuff? :-)
Nosredna
+1  A: 

I wish it were "uncommented in."


I use "revived" or "restored" for code that used to be commented out, but no longer is. I use "live" or "uncommented" for code that's intended to be compiled or executed.

Nosredna
A: 

Seeing how many disparate answers exist for this question, there are a few things you should do.

  1. Pick a term and stick with it.

    Consistency is most important. It's okay if it's not the best one ever, and you can change your choice if a more obvious term appears in the distant future.

  2. Explicitly describe that term to your teammates.

    Don't just say, "it means uncommented, or whatever you call it." Don't just say, "it's the opposite of commented." Tell them that it means code that was previously commented out, and has now had its commenting syntax removed. Tell them that this code is now active and will execute when called. Never assume that your team is smart enough to "just get it" just because they nod when you use the term.

As a subjective answer, I use the term uncommented. It's a bad name for the behavior, but at least it's mildly intuitive. It beats nonsense like unhashed for languages that use the # character for comments.

Wesley
A: 

I honestly do say "commented in". In phrases like "well, it works with that line commented out, so let's comment it back in and re-run the test". "Uncomment" would be more correct, but sounds clunkier. I wouldn't use that expression in formal writing, though, just when talking to my pair.

Tom Anderson
A: 

During a debugging session, I often comment and uncomment lines of code.

From a purely semantic (and yes, anally pedantic) perspective, it's the action that's described by the phrase, not the code.

"Commented Out" is a verb describing the action whereby a statement was turned into a comment to remove it from the code that's acted upon by the language's parser.

Code having been subjected to the opposite action, that of taking a comment and turning it into a statement to include it in the code that the language's parser acts upon, would be "Statemented In". But of course that's ridiculous.

That said, I agree with Andrew that outside of a transient debugging session, before it's committed, code should be removed if it's not used and not left around in comments to confuse things.

Hey there Brent!
Ollie Saunders
A: 

The problem is with the term "commented out". It's an abuse of the comment feature of most languages. In C/C++ you should use the preprocessor to conditionally compile your code, perhaps like the following:

#if 0
...
... here is the code that is not in the build
..
#endif

...
... here is the code that is in the build
...

I recall a coding standard in a place I used to work at used "#ifdef NOT_DEF" and a few other symbols in place of "#if 0" to add some semantics to the "commented out" block.

The terms used under this scheme were "included" and "excluded" code, though "included" was usually assumed when talking generally about "the code".

Of course, not all modern languages have such a preprocessing feature, so you're back to abusing the comment feature.

Daniel Paull
I try to avoid using conditional compilation, since you can introduce errors since the code being compiled isn't the same. A better bet is to define a macro at compile time that you're debugging (i.e.: gcc -DDEBUG=1 for debug, gcc -DDEBUG=0 for release), and wrapping debug code with if(DEBUG). This way you always compile the entire codebase, but you don't use it if its in the release build. The only issue is that it can grow the release executable since all the debug stuff is still there.
A. Scagnelli
"-DDEBUG=1" on the command line is equivalent to a "#define DEBUG 1" at a global scope. It's still conditional compilation! In your case the code sections inside a if(DEBUG) block will _not_ be compiled in release builds.
Daniel Paull
A: 

I ended up going with commented code being code under comment and normal code being code not under comment. The action being take code from under comment or bring out from under comment.

Ollie Saunders