lunedì, febbraio 05, 2007

Code Gallery: create and destroy

Known as "stable" code, a so called J2EE web application, period: year 2005:

//used in the creation of some kind report
public void shiftColumn(...)
{
    //do somethig
    if ( isBlankCell(table, row, srcCol) )
    {
      cell = row.createCell((short) destCol);
      row.removeCell(cell);
    }
    //do somethig else
}


Comment: a great example of coding for obfuscation, which states: "never ever will you clearly express your intention through code".
Why creating a new cell and destroying it the line after? And why that subtle test, which checks for srcCol, but creates a new cell at destCol? The artist leaves us slightly dazed and confused, while thinking of his wisdom.

1 commento:

Odette ha detto...

Keep up the good work.