Archive for the ‘Programming’ Category

Less Than Mere-Moments Installation of Subversion

Tuesday, September 6th, 2005

Inspired by Joe’s Mere-Moments Guide to installing a Subversion server on Windows, I have created an installer that will walk you through the steps that are required for installing Subversion on Windows. You can find my project here: http://svn1clicksetup.tigris.org. It still has room for some refinements, but it should make the installation process even easier. If you haven’t tried SVN yet, I would highly recommend doing so.

Still a magic number?

Friday, August 26th, 2005

So Sam and I were programming today, and we found a place in the code where we were using a magic number. Something along the lines of:

function TMyObject.IsEditable: Boolean;
begin
  Result := obj.IsEditable(1);
end;

Wanting to replace the magic number with a meaninful symbolic constant, we looked around for what the magic number could represent. After failing to find what exactly the magic number meant, and not wanting to leave a magic number in the code, we replaced it with our own meaningful constant. The code now looks more like this:

function TMyObject.IsEditable: Boolean;
const
  MagicNumber = 1;
begin
  Result := obj.IsEditable(MagicNumber);
end;

So, if we replace a magic number with a poorly named constant, is it still considered a magic number?