Discussing the nuts and bolts of software development

Thursday, July 17, 2008

 

Maintenance Nightmares: Commented out code

I was working on an estimate for a prospective customer, and luckily I had the code to examine beforehand to see what it was doing.

While examining the code, I noticed code like this:

// Fix for bug 1021892
// some code that was commented out.

There were instances of this throughout the code.

When I see this I instinctively cringe, I immediately think that there is no proper source control or defect tracking procedures (or tools) in place. While there may be the odd corner case where commented out code is acceptable, in general it is not and should be avoided.

There are many better ways of dealing with this, the first way is to just delete the line of code, and when you commit/check-in the code, make sure you put a meaningful comment in the commit logs that ties it to the defect it was changed for. You can often search the commit logs, and if you put the bug id in the commit log, you will get the change in your search.

Another easy way to do this is to delete the line of code, make a patch, and when resolving the bug in your bug tracking software, attach the patch file to that issue. Then you can always see what you changed to fix the bug.

Does anyone else having any suggestions for this?

Labels:


Comments:
I think placing comments about the deleted code in the commit logs or patch's change log is the best way to deal with this kind of problem. Sometimes it is also possible to write done little explanation comments in the code, but just commenting out the code which should be deleted is not a good practice.
 
Not that I want to one-up you on this but I have been doing work with a popular ASP.Net component library.

With that library, when you buy a certain level of license, you get the source. I looked in there and is was scary. They seem to be doing version control with #ifdef statements.

The code is littered with #if V3.2 type of statements. I wonder if they ever heard of branching?
 
That is so crazy, I still can't believe that. Whoever did that deserves a special place reserved for them in the customer support section :)
 
You can always order your paper here https://paperovernight.com/blog/five-page-paper. This is very handy!
 
Looking for a finance homework writing service in the USA? Look no further than 123Homework.com! We offer a wide range of services to help you with your finance homework, including essay writing, term paper writing, case study writing, and more. We have a team of experienced writers who are experts in the field of finance, and we can help you get the grades you need. Contact us today to learn more about our services!
 
I think placing comments about the deleted code in the commit logs or patch's change log is the best way to deal with this kind of problem.
 
Whether you're going for that motorcycle-chic women's leather jackets look or just want to add a little edge to your outfit, a leather jacket is a way to go. Plus, they just look cool.
 
That is so crazy, I still can't believe that sonja morgan husband john morgan deserves a special place reserved for them in the customer support section :)

 
The easiest method to handle this type of issue, in my opinion, is to add notes about the deleted code to the commit logs or change the log for the patch.
 
This article is a great reminder that, as software developers, we need to take a proactive approach to maintenance. All too often, we are faced with code that has been commented out or otherwise left in a state of disarray. As someone who has dealt with these maintenance nightmares in the past, I can attest to the fact that they can be a huge time suck! It's important to keep our code well organized, up to date, and commented so that when it comes time to maintain it, we can quickly identify issues and make fixes without wasting time.
 
At Trademark Alpha, they specialise in providing high-quality trademark registration services to clients. With their team of experienced trademark attorneys, they assist clients in protecting their brands, logos, and intellectual property through the trademark registration process. Trust Trademark Alpha to deliver fast, reliable, and efficient trademark registration services that meet your business needs.
 
First off, I have to say that your blog post on maintenance nightmares had me cracking up from start to finish! As someone who has dabbled in coding and software development, I could totally relate to the struggles and frustrations you described. It's like you took the words right out of my mouth! Your witty storytelling style and humorous anecdotes really made the article a delight to read.

As a student myself, I've been in situations where I've desperately needed assistance with my academic papers, especially when juggling multiple assignments and deadlines. The pressure can be overwhelming at times, and that's where reliable essay writing services like do my essay britain can come in handy. They can provide valuable support and help alleviate some of the stress associated with academic work.
 
Donald Martinez is a really good cosmetic surgeon who works in Dubai. He is famous for making people look better through his surgeries. Donald loves to help people look more beautiful and feel better
about themselves. He is dedicated to giving the best cosmetic surgery services.

As a top doctor who helps people look better in Dubai, Donald Martinez can do many different types of treatments that are made just for each patient dubai cosmetic surgery clinic Donald is very good at making people look better. He can help your face look younger with treatments like facelifts, rhinoplasty, and eyelid surgery. He can also make your body look nicer with procedures like liposuction, tummy tucks, and breast augmentation. Donald is really skilled and can give you amazing results.
 
Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot. and i also want you to visit our website animal care sanctuary
 
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging, football coaching books
 
Nauti Yacht Sales, the premier destination for selling your boat with ease and confidence. If you're ready to part ways with your beloved vessel, Just click on this sell my boat our experienced team is here to guide you through a seamless and rewarding selling process.
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?