Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: Default values in propety file.

 
Chris Harris
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
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?
Thanks
Chris
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Phil:
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,

That is what I did.
Best,
Vlad
[Andrew: Changed [code] block to [quote] block]
[ October 29, 2003: Message edited by: Andrew Monkhouse ]
 
Chris Harris
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice. Nice to know I am going down the right route
Chris
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, do we need to restore the previous values of the user?
If not, it seems that we do not need to have the property file anyway.
Thanks
 
Paul Tongyoo
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nicholas Cheung:
In fact, do we need to restore the previous values of the user?
If not, it seems that we do not need to have the property file anyway.
Thanks

Hi Nicholas--
I don't know what version of the Sun assignment you have, but it probably has the same paragraph as mine with the following statement (emphasis added by me):

All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration must be stored in a file called suncertify.properties which must be located in the current working directory.

Your assignment probably has similar statements; the first implies that the last user values should be used in the next run of the program, and the second statement explictly states the required use of a properties file.

Regards,
Paul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic