|
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(); }
}
|
|
|
|
|
If you have everything checked into version control, then there is not much need to keep old code. However, most of my code goes into libraries and the job at hand is supposed to be only a thin layer on top of those libraries.
That kind of code does not become obsolete. It is constantly adapted and improved. Some of my code has reached a biblical age this way and is far from obsolete. I can't think of a more productive way to work, at least as long as Mickeysoft does not decide to pull away the rug under my feet by throwing everything overboard for their next great idea.
Sent from my BatComputer via HAL 9000 and M5
|
|
|
|
|
This is the only right answer...
|
|
|
|
|
Except that it can be very hard to find... where did I put that discarded function? It's in one of a possible dozen possible files checked in betweeen 2011 and 2013
|
|
|
|
|
Yes, and the many many branches and the comments you did not enter when checking in also don't help. And let's not talk about the nonexistant documentation or change management. Version control can be hell.
Sent from my BatComputer via HAL 9000 and M5
|
|
|
|
|
...so I can travel back in time and recover that clever thing that I shouldn't have deleted.
|
|
|
|
|
I just got a question in my mind "How many times we follow commented code ?"
I have commented a part of code last year and this year i did same development on some other forms, i really forget that i have same piece of code somewhere in my project. Really interesting
I think in some pressure condition we really forgot about the code that was commetned some months/days ago, and do the same coding.
Do you ?
Rating always..... WELCOME
The only reason people get lost in thought is because it's unfamiliar territory.
|
|
|
|
|
No, I don't. Redundancy is one of my oldest enemies and I go out of my way to get rid of it. And even in the days of hex keypads and hand written machine code I already organized my code into libraries to keep the problems I hade previously solved and bugs I had previously fixed at hand for future use.
Nothing, not even the gratest framework in the world, beats a self made library of proven code, right in whatever domain you happen to work in.
Sent from my BatComputer via HAL 9000 and M5
|
|
|
|