Safegaurd Your Comments – The Daily WTF

Date:

Share:

I’ve had the misfortune of working in places which did source-control via comments. Like one place which required that, with each section of code changed, you needed to add a comment with your name, the ticket number, and the reason the change was made. You know, the kind of thing you can just get from your source control service.

In their defense, that policy was invented for mainframe developers and then extended to everyone else, and their source control system was in Visual Source Safe. VSS was a) terrible, and b) a perennial destroyer of history, so maybe they weren’t entirely wrong and VSS was the real WTF. I still hated it.

In any case, Alice‘s team uses more modern source control than that, which is why she’s able to explain to us the story of this function:

public function calculateMassGrossPay(array $employees, Payroll $payroll): array
{
    
    return [];
}

Once upon a time, this function actually contained logic, a big pile of fairly complicated logic. Eventually, a different method was created which streamlined the functionality, but had a different signature and logic. All the callers were updated to use that method instead- by commenting out the line which called this one. This function had a comment added to the top: // it shouldn't enter here.

Then, the body of this function got commented out, and the return was turned into an empty array. The comment was expanded to what you see above. Then, eventually, the commented-out callers were all deleted. Years after that, the commented out body of this function was also deleted, leaving behind the skeleton you see here.

This function is not referenced anywhere else, not even in a comment. It’s truly impossible for code to “enter here”.

Alice writes: “Version control by commented out code does not work very well.”

Indeed, it does not.

[Advertisement]
ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.

Source link

Subscribe to our magazine

━ more like this

The Top Shelf’s Favorite Aesthetician Shares Her Routine

“I only went to aesthetician school because I wanted to learn about skin, but when I was there, I discovered that I loved giving...

10 Hacks Every Telegram User Should Know

Telegram is among the most popular WhatsApp alternatives...

Morlaix Street Art in Morlaix, France

Morlaix is a medieval market town in Brittany. The Old Quarter has many half-timbered buildings overhanging the narrow cobbled streets.  The last thing...

Transformation in action: Raising the bar for customer experience

Delivering a perfect customer experience has always been the goal for support teams, and now with AI, this is actually possible. In The 2026 Customer...