Hi Chris,
The assigment states that all properties should be stored within the a suncertify.properties file. I have just read properties guide which talks about loading in default values first then last your properties.
However using this approch, I understand you would have two suncertify.properties files (one with default value and the other with last users values). Is this allowed in our assigment?
Allowed yes, but I will not do it. Defaults are ... just defaults. You probably know at development time what are acceptable default values for your properties when they exist (not the db path name of course, but well a default listen port). I prefer getting my defaults from constants, because I am sure that those acceptable defaults will never be corrupted. In the case the suncertify.properties file doesn't exist, all my settings get their constant default value (db file name is then an empty
string, port is let's say 3500, and so on). Now in the case the properties file exists, I may still use those constants in the case I notice some value(s) read from the file are incorrect (some of them must fall within an acceptable range). It's complex enough IMO. If defaults come from a file too, I need constants anyway in the case the default properties file is not found. And if it's found, I need to validate one more file.
Mmh... just for once, I'd like to write "Keep it simple !"
I'll come back soon with a new
thread in the same area because a design question I have myself.
Best,
Phil.
[ October 26, 2003: Message edited by: Philippe Maquet ]