Good method names are one of the primary ways to write self-documenting code. The challenge there, is that documentation often becomes out of date.

Take this delectable PHP nugget, from Nathaniel P, who has previously been tortured by bad date handling.

function deleteTenDays()
{
        
        $thedel = $this->db->query('Delete FROM ClientReportsRelationship where DateEntered <= (CURRENT_DATE - Interval 31 DAY) ');
        
}

The function is called deleteTenDays. The comment tells us that it “delects everything” from the table “minus 3 days”. The actual delete query deletes everything older than a month. For bonus points, there’s a commented out query which just deletes everything from a single customer.

Honestly, this function needs to be delected.

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

Remy Porter

Source link

You May Also Like

We Thought The Log Flume Ride Would Be Fun

“My sister and her kids came to visit from New Zealand and…

Video game memes for gamers of all ages (23 Photos)

Jacob Source link

Sgt. Bilko Named New Secretary Of Treasury

Thursday, 15 December 2022 BILLINGSGATE POST: This morning, President Biden named Sergeant…

I Think We Should Call PETA – People Of Walmart

The post I Think We Should Call PETA appeared first on People…