"Following the code-as-a-commodity principle," writes Jan, "our management team not only sends large projects overseas, but goes with the lowest bidder."

/**
 * @param str The string which must put into 2 Signle Quat
 * @return The single quated String
 */
public String SingleQautedString(String str) {
  return "'" + str + "'";
}

 

"The comment explains it all," writes Kendall via the Submit to TDWTF Visual Studio Extension.

//cumulative normal distribution function
public string TEST(string test)
{
    return test + "TEST";
}

"I took this comment as a challenge," writes Andrew, "and I lost."

// ATTENTION: IF SOMEONE READS BLOCKS OF CODE ABOVE AND BELOW
// THIS LINE - PLEASE DONT TRY TO UNDERSTAND IT - I DON'T

 

Steen learned about a new configuration option.

if (GlobalConfig["UseSpellingError"])
{
    pKey = pKey.replace("gb_custom", "gb_costum"); 
}

 

Dave writes, "while reconfiguring Sybase stored procedures for a custom version of an HL7 interface application, I stumbled upon this useless-yet-used everywhere procedure."

create procedure dbo.SpTCRUtl_showNumTelHL7
    @numTelIn  varchar(50), 
    @numTelOut varchar(50) output
as

  set @numTelOut = @numTelIn 

 

"I found this code at the day job (a large bank)," notes Dave, "maybe it's just me, but I would think a single 'if' statement could have done the job."

for i=3000 to 3299
    if cint(val)=cint(i) then
        bolMatch=true  
        exit for 
    end if
 next
     
 for i=3351 to 3441
    if cint(val)=cint(i) then
        bolMatch=true   
        exit for
    end if
 next     

 for i=5964 to 5969
    if cint(val)=cint(i) then
        bolMatch=true   
        exit for
    end if
 next

 

"A lot of students only go to school three quarters a year," Bob writes, "so maybe the author thought a business might take a summer off. Or try to squeeze another one in."

const QUARTERS_IN_A_YEAR = 4;

... several codefiles later...

private String[] getQuarters() 
{
   String[] quarters = new String[QUARTERS_IN_A_YEAR];
   for (int k = 0; k < quarters.length; k++) {
      quarters[k] = new Integer(k+1).toString();
   }
   return quarters;
}

 

"While looking through some old code, I found this snippet that creates a 'human friendly' date to display to the user," Adam Smith writes, "perhaps this is more efficient than date('d/m/Y')."

// Get today's date, and also format it in a more human-friendly way
$date = date("Y-m-d");
$nicedate = preg_replace("/(....).(..).(..)/","$3/$2/$1",$date);

 

"I'm still not sure if the comment is a todo or an actual comment on what the code should do," notes Alexander, "both possibilities have not been achieved though."

/// <summary>
/// REMOVE THIS!!
/// </summary>
public void RemoveMeFunction()
{
  throw new NotImplementedException();
}

 

"We use a strange naming convention here," J Klopchic wrote. "I should note that 'operations' really doesn't mean anything, but it sounds better than print_lbl_label_label. Too bad that print_label, print_lbl_operations_label, and print_lbl_operations were already used."

string component_id = "print_lbl_label_operations_label";

 

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!