|
|
This poll is a very extreme example of a poll with missing possible answers. Now I usually delete and in very occasional cases comment. However, I simply know that many people just leave the code in and simply "know" it does not get executed. Some only comment the condition and state, that it never gets executed.
The result is, that the clumsy people are not even left a chance to be honest, even if most of them maybe would not be honest, if they had the chance to be.
All in all, another poll that went down the drain. What a pity.
modified 25-Jun-13 19:34pm.
|
|
|
|
|
Agree. There are times when the user wants features removed, but I know they someday they're bound to want them back. I comment out that code and make it "inactive". To re-add it later, if it were deleted, would be significantly more difficult than re-integrating commented out code. It may be years that the code stays inactive, but when the day comes, I'll be ready...
|
|
|
|
|
I think the poll is just fine.
In fact, I merely commented out the poll's web page in my browser history, because you never know when such a poll might be useful in the future...
|
|
|
|
|
Yes it could have done with a 'I swing both ways' option... but then there's no real point to the poll if you have so many options that you don't really get anything definitive out of it
"For fifty bucks I'd put my face in their soup and blow." - George Costanza
CP article: SmartPager - a Flickr-style pager control with go-to-page popup layer.
|
|
|
|
|
I could certainly add many, many more answer options to a poll and asymptotically approach a set of answers the cover everything, or I can post a poll that gets a bit of discussion going. I know which one is more interesting.
Feel free to suggest a poll yourself[^].
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
Alright, so you think I am suggesting, that giving more answer options is always better?
Choosing the right set of answers is not trivial and a key ingredient to getting informative results. Discussions tend to get off topic or just difficult to follow when most options are missing, because most posts are just about their own two cents and not react on the input other people give. Giving too many options obviously is also not productive, but having only two options for a question like this kills the result and the discussion in my opinion.
A discussion, enumerating what has been missing from the set of answers is not too interesting in my opinion, but I hope you find that interesting.
|
|
|
|
|
Wolfgang_Baron wrote: Alright, so you think I am suggesting, that giving more answer options is always better?
No, I was making an inside joke that no matter what answers I put in a poll there will always be someone, somewhere, who comaplains that I've missed an option.
So OK: What choices would you like to see to have a fully rounded poll that encourages debate without reducing the need for interesting discussion?
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
You have the option to not vote and add your comment on the topic in a more detailed way.
Please abstract from the actual poll result - this does not really matter - it's more about triggereing a discussion on the topic.
Cheers
Andi
|
|
|
|
|
If you know the logic just add a line why the code has been removed with version if you want to maintain it too.
It's really far better dumping out the unnecessary code and keep your code neat and clean.
Sometimes it may happen that you need the removed code, if this is the possibility why you kept it commented; then you should also agree with the possibility that you could come up with far better logic next time for the same thing. But only because you've commented it you will never even think of that.
|
|
|
|
|
While working I comment out but come commit, the old code is deleted. Dead as French Attack.
Reality is an illusion caused by a lack of alcohol
|
|
|
|
|
Nagy Vilmos wrote: Dead as French Attack
Like the battle of the Chesapeake?
|
|
|
|
|
For me, it depends on the situation, I have created utility libraries for debugging live code. And I will comment out the one or two lines of code that access the utilities. However the lines are commented as to their function and how they are used.
When we develop a new product we generally use one of a set of communication protocols but as new parameters are introduced it is useful to see how the data stream is being parsed. It can be a real time saver.
Code that serves no purpose because of code reduction or improved processes, need to go away.
It was broke, so I fixed it.
|
|
|
|
|
I comment the code out - just in case I need to undo the damage, as a reminder, and stuff like that. Eventually, when suitably aged, it is removed.
Just a habit of caution - like carrying a second car-key: even if you only need to use it once in five years to get into your car because you lost or locked you key inside to make it worth it. So it is with seeing what you've done that you've, for any number of reasons, decided to undo.
I need to point out that the above cautions aren't quite as effective with marriage or parenthood.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
It had a policy of never deleting code, only commenting. We also used vi to edit these files, so we were often looking for /* or */ in 100s lines of visually undifferentiated code
Some bright sparkhad the idea of banning /* */ in favour of // which made things easier. But not as easy as the best dev in the department letting me into the secret that we were, in fact, allowed to use EMACs (with glorious syntax highlighting). He said vi was only prevalent because of "macho bulls**t posturing" by the other staff .
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
Mostly I remove (source control) but occasionally I comment out it (for removing it some future iteration)
|
|
|
|
|
Worse than commenting it is not commenting it at all...
Code within IF blocks can easily never be executed, and I've seen this being use on purpose...
Am I the first to find an
if (false) { code block?
Use the source control of your choice... please!!
Cheers!
|
|
|
|
|
Yes, I had a co-worker whose favourite "thing to avoid having to clean up functions" was exactly that, and saying nothing, writing no comment at all. He usually had really good ideas, but he was a fvcking lazy bastard and a pain in the ass if you had to complete something started by him.
The most positive side for me was... I really had to learn very fast to be able to understand that code and, I had the best teacher in how NOT to do several things.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
If used *sparingly* I don't see an issue with this. If you're likely to re-enable the block soon its a viable option - with the benefit that the code is more readable with syntax highlighting versus a commented block.
"For fifty bucks I'd put my face in their soup and blow." - George Costanza
CP article: SmartPager - a Flickr-style pager control with go-to-page popup layer.
|
|
|
|
|
For me you could do whatever you want as long as you don't push it to the repository like that!
|
|
|
|
|
That's amazing. Just add comments.
if (false) {
}
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
Flavors of the following are usually frequent in this "best practice":
if(1 == 2) {
|
|
|
|
|
Right?
I hate seeing laziness of other programmers.
If you need it don't comment it out. If not delete it.
No more Mister Nice Guy... >: |
|
|
|
|
|
Usually I comment out unused code, then after a reasonable amount of time and no screaming from users I remove unused comments and cleanup the code.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
|
|
|
|
|
I have some co-workers who do.
It bugs me a great deal seeing commented out code and it makes me think "is this obsolete or is this intended to be used at a later time?".
It obfuscates code that does matter, especially other comments.
There's a reason it's commented out and that reason is probably that the code didn't work or that the specs have changed and you don't need it anymore. There is no reason to keep it around.
Old code will always be available through source control.
Please just delete old and unused code. If you really think you'll need it someday again just keep it in a personal text file or something.
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|