Monthly Archives: April 2009

Next in the series of plaintive Delphi cries, one to (some of) the *users* of Delphi

To many of the Delphi developers I have encountered:

Please memorise the following: Format
Message := 'There are ' + IntToStr(numBunnies) + ' bunnies in the forest.' + #13 + 'That comes to ' + FloatToStrF(bunnyDensity, ffFixed, 4, 2) + 'bunnies per acre.';

Message := Format('There are %d bunnies in the forest.%cThat comes to %2.2f bunnies per acre.',[numBunnies, #13, bunnyDensity]);
See how much prettier that is? Please start using it. I beg of you.

Also, consider:
function FunctionNamedFoo: Boolean;
a function which returns a value. You can either place the return value of the function into the keyword variable Result or into the locally-scoped variable FunctionNamedFoo. As you write more and more functions, please decide on the style you prefer and stick to it. Please.

I personally prefer the FunctionNamedFoo approach, since it makes searching the source code much easier. My despair on this issue is however so great that I no longer care which you choose, as long as you choose but one.

Delphi developers I have encountered: Thank you for listening.
Everyone else: My apologies. I do feel better now though.


Filed under delphi, Uncategorized

A light morsel of advice

A word of advice: If you spend the weekend at a self-catering Drakensberg resort, you may decide to braai both your Friday and Saturday evening meals. If the braai stand is not lit, and you neglected to bring a torch, you may then decide to use your car’s headlights to illuminate the braai stand. You will then probably tell yourself to start and run your car for a few minutes the following day, to ensure the battery isn’t depleted if you use the headlights the following night.

If however you are really lethargic on the Saturday and you forget completely about starting your car, do not compound the error by forgetting that you forgot and using your headlights to again illuminate the braai stand on the Saturday evening. If you do this you may well find yourself sheepishly asking the reception if someone might be available to help you jumpstart your car, while your fiance tries very hard not to burst out laughing at you (with just cause).

This is of course entirely hypothetical, just a piece of advice I figured someone may need some day.


Filed under Uncategorized