configure using properties rather than arguments ?
dean tomlinson
Ranch Hand
Joined: Jan 31, 2002
Posts: 94
posted
0
What is the preferred technique for specifying variables to a program (such as the datasbe filename, the operating mode etc). specifying them as arguments hard wires the order of the parameters in the command line, and makes the validation within the main method a bit more lengthy. where as specifying them as properties, removes the restriction on order, and is really easy to validate - it generally seems a more flexible, solution. currently i am using properties, but is this going against any convention ?
Using property file for configuration is always a good idea. Because you can change it without changing code. The downside of it, is teaching the user how to set it up correctly. But you would have to teach the users the correct command line arguments to pass also. I don't know if it would have an effect on your scoring though. Mark
hi mark - thanks for your response. just to clarify, i am not using a properties file for configuration in this assignment as it says that the examiner must not have to edit any files. i always use a properties file, for the configuration of the web applications i develop commercially. what i mean't for the assignment was is it ok/prefered to use ...