Thursday, January 26, 2006

Meeting your Schedule - A Few Tricks

So your boss has just walked in and informed you that the project has 4 new requirements from the customer, one of which forces a redesign of some basic part of the project. The deadline doesn't change, of course, because that was set in a contract a few months ago, and the customer would be shocked at the suggestion that these newly-discovered requirements should make the project take longer!

I can't tell you how to redesign your project to meet the new requirements, but I can give you some tricks that, taken at the start of the project, can make your life easier when this situation occurs - and believe me, it will occur.

  1. Buy and read "The Pragmatic Programmer". I cannot stress enough how utterly cool this book is for developers. This book codifies a great deal of wonderfully useful information.
  2. Put your program configuration into a file or a database. Resist the urge to use environment variables. If you make your programs read from a database or file from the start, and you have a trigger to re-read the configuration when desired, you will be able to adjust configurations on the fly.
  3. Put your configuration in a Singleton object, and have methods that return the various values you need from this object. The re-read function can be done either as an explicit method, or part of the constructor, where the signal to update the configuration will delete the configuration and the next use will resurrect the object from the modified file/database.
  4. (added later) If you have a configuration option that is intended for a old feature/new feature type of thing, write the code to default to the new feature version in the absence of any configuration, and only do the old feature stuff if the configuration is set to 'use old'. This will allow you to phase out the configuration flags as the old features drop of the supported list, and your code will be cleaner as you delete code the references the unused configuration flags.
The point of all this is to make it easy to introduce flags and values for new features into your system, so that when the boss tells you that there are new requirements, you at least can have your programs detect these variations easily and in a consistent manner. You need to build this in from the start, so that the code will have only one method of getting configuration information and you will not have to spend much time tracking down oddball data accesses.



Technorati Tags --



No comments: