Saturday, March 25, 2006

Refactoring Revisited & Installer Heaven

Well I have been a busy bee indeed as programming operations have moved from the United Kingdom to Thailand - the weather is warmer, the cost of living cheaper and since the sun shines more often - I tend to feel more inclined to write code and good code at that!

Reorganised the class library in what should be the last time - now it follows a similar convention to .NET itself so all generic classes are in a root namespace and base device and page classes are grouped together in a componentmodel namespace.

This has helped no end in reducing the number of namespace entries within each code file significantly.

The component libraries are now signed with a strong name and I have also created a reference class which is shared via source control to each of the DB assemblies - this assembly reference contains strings which simplify the task of referencing other assemblies in type names and so on.

I have also started work on installer classes to facilitate the installation/uninstallation of database device components (rather handy they are components eh?) This work has changed the focus to how these devices are installed and where the responsibilities lie in dealing with scope of work and in definition of pages.

A few things have fallen out of the installer work - I have a base DeviceInstaller class (derived from ComponentInstaller) from which a hierarchy of installer classes are derived from.
Installing a device involves execution of the following;

  • Creation of installation-time device component

  • Attaching to parent device (as necessary)

  • Pre-mounting tasks

  • Create/mount of device

  • Post-mounting tasks



The logic controlling the sequencing of these operations is encapsulated within the DeviceInstaller base class.

Pre-mounting tasks involve setting up the static device settings. The ID and Name are handled by the base class with everything else being handled by the appropriate derived class.

Post-mounting tasks involve the setting up of device pages as determined by the installer. DatabasePhysicalDeviceInstaller will create distribution pages here and update the root page information (as created by the PhysicalDeviceInstaller)

Certain installer classes will need to record state information to facilitate rollback or uninstall operations.

No comments: