Archive for 12th May 2011

Just being thorough

I always get a little nauseous when looking through someone else’s code and seeing things like this:

res = sqlite3_exec(database, [select UTF8String], NULL, NULL, &errorMsg);
if (res != outcome) {
    [testStringCapture appendFormat:@"%@,",obj]; //changed 2/2/2011
}
else {
    [testStringCapture appendFormat:@"%@,",obj]; //changed 2/2/2011
}

Alas, a little later on in the same method was some code that soothed my sensibilities as it is kind a perfect fit into the whole “do something here” theme:

res1 = sqlite3_exec(database, [select1 UTF8String], NULL, NULL, &errorMsg1);
if (res1 != outcome1) {
 
}
else {
 
}

As per usual, these code snippets are unedited (except for some formatting) portions of production code.