June 0908

Commenting code and filenameOLD

A little while ago I introduced Subversion at work, they were relying on backups and a manual process of creating Grandfather, Father, Child copies of the projects they were working on. Coupled with that was the practice of keeping previous versions of files hanging around (in case something went wrong with a new version) by adding the word “OLD” to the filename, looking through these files I could see huge chunks of code commented out – sometimes with a reason given for excluding the code block, but often not.

I am now in the process of cleaning this lot up, we have a little Perl script that checks every file in a solution for the string “old” somewhere in the name, it then looks for a version of the file without “old” (what ought to be the current version). Initially the Perl script simply generated a list of the files, so we could check that nothing important was being selected, but then it was run to delete the offending files. As the solutions have been in a repository for a little while the current versions of the files are safe and sound in the repository and, for that matter, so are the “old” versions if we ever needed to restore them we could.

However I am quite happy now, we got rid of about 200 pointless files and as we work on other files the commented out code can simply be deleted. This makes it much easier to read the code and the files are obviously a little smaller which comes in handy as some of the files are html. Cleaning up the code feels good! Open-mouthed

Permalink | Comments (1)

Comments

  1. Michael United States Michael (Thursday, July 02, 2009) #

    thanks

Comments are closed