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.
- 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.
- 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.
- 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.
- (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.
Technorati Tags --
Software
SoftwareDevelopment
Computers
Programming
No comments:
Post a Comment