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()
{
//This delects everything from the table minus 3 days
$thedel = $this->db->query(‘Delete FROM ClientReportsRelationship where DateEntered <= (CURRENT_DATE – Interval 31 DAY) ‘);
//$thedel2 = $this->db->query(‘Delete FROM ClientReportsRelationship where CustomerId = 33 ‘);
}
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.
ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.
Source: Read MoreÂ