Archive for March, 2007

New Putter

gommo March 13th, 2007

I’ve taken the first steps to improving my golf bag with the purchase of a TaylorMade Rossa Monza Corsa.

TM Corza

I don’t think the putter is going to magically improve my strokes but I know I’m going to enjoy putting a heck of a lot more!

Lazy typed languages and sometimes they suck!

gommo March 8th, 2007

Just a small rant about php. Sometimes it can waste a lot of my time simply because not only does it not require variables to be declared but it’s case insensitivity often leads to mistypings becoming hard to track bugs.

In my most recent case I made a modification to an existing document management system. The modification is detailed but the part that caused issues was a little feature that allowed you to control whether or not you could check a document back into the server under a different filename than what was originally checked out. We made the decision early on to not allow this behavior. The actual control for this was a checkbox on a form. In error I simply commented out this code forgetting that the variable used to access this checkbox now would be created further down in the logic below.

$sPrefixedFileName = KTDocumentUtil::getDocumentFilenameWithPrefix($this->oDocument);
if ($sPrefixedFileName != $_FILES['file']['name']) {
   if($bForceFilename) {
      $this->errorRedirectToMain(....);
   } else {
      $aOptions['newfilename'] = $sNewFilename;
}

The bForceFilename variable doesn’t exist so it defaults to null and we end up enabling checking in documents of different names to what they were checked out under. Previously I also had issues where variables were named slightly different in terms of case and of course these are just nulls then. You end up scratching your head wondering why variable assignments aren’t working until you realise the variable is $sSomeVariable in one place and $ssomeVariable in another place.

I’m all for dynamic languages in general but I’d like to have the option to force declaring the existence of a variable before use. That would save hours of chasing these little errors around.

Annoying little problems