This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The following requirement is listed as one of the bullet points under the heading The User Interface in my instructions.html:
The program must allow the user to specify the location of the database in both standalone and network mode and persist the db configuration details in suncertify.properties file. The application must read the properties file to determine the location of the db and display the data from the db.
Does this mean I need to allow the user to tell the system where db is located via the GUI? I assumed that the user would find the suncertify.properties file and change the value themselves if they wished to move the db.
If this is the case, does my program need to allow the user to change the location of the db at any time during operation?
You are (I assume) a developer, not a mediocre user.
The dialog offers in standalone mode the possibility to relocate the application to another database file. In server mode you can also change the database file location and the port number the server will be listening on. In network client mode the user can change the server location (ip or host name) and the port number it's running on.
I was confused by this requirement too. After my analysis, it should be like this:
1. Developer create a properties file that stores:
dbLocation = ..\code\suncertify\db\db-xxx.db
portNumber = 1099
That means the dbLocation specify the relative location of the db file and the portNumber by default is 1099. In NetBean platform or Eclipse, we must create a folder called code to store all our code. Our classes files are all stored in bin directory. So, the relative location shows to move a directory up, look for code\suncertify\db for the file
2. Users start the application and the dbLocation and portNumber are filled in the window.
3. A user may want to change either or both information. For example, this user changes portNumber from 1099 to 8080.
4. After step 3, the new portNumber is saved in the properties file.
5. Another user starts the application and this user's portNumber is 8080.
1. Two users start their own application.
2. One user changes the port number to 8080 and the port number is saved in the properties file.
3. Should the second user see the change of 8080 as well?
1. In network mode, a user starts the network server and the port number is 1099 by default based on the properties file.
2. When the user start the client side and update the port number to 8080, this user must get an error message "can't connect to server with 8080".
Is this what developer should do?
Helen Ma wrote:dbLocation = ..\code\suncertify\db\db-xxx.db
I didn't store a default database file location, because that's impossible to know where a user has stored the database file.
Helen Ma wrote:3. Should the second user see the change of 8080 as well?
If 2 users use a different computer to run the application and 1 user changes the port number, the other user will not see this change (because it's only changed in the local properties file on the computer of 1st user).
Helen Ma wrote:Is this what developer should do?
If the user provides a wrong port number, he should get an error message of course.
Joined: Nov 01, 2011
Thanks for your reply, Roel.
But the instruction specifies that "All configuration must be done via a GUI , and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties"
The configuration consists of DB file location and port number that connects to the RMI / socket server.
I think the instruction requires us to persist the DB file location and port number in the properties file. In real-life application, users put their configurations in a properties file, so that they don't need to configure them next time they start the application.
I guess this persisting of configuration is required for the exam to simulate real-life applications.
If my application starts a dialog is shown where user can enter the configuration details as needed. When everything is fine, these details are saved into a file suncertify.properties (in the current working directory). When the user starts the application again, the dialog is shown again and the configuration details are loaded from the suncertify.properties file (which the user can change or just leave them as-is). So the configuration information is persistent between runs.
Roel De Nijs wrote:If my application starts a dialog is shown where user can enter the configuration details as needed. When everything is fine, these details are saved into a file suncertify.properties (in the current working directory). When the user starts the application again, the dialog is shown again and the configuration details are loaded from the suncertify.properties file (which the user can change or just leave them as-is). So the configuration information is persistent between runs.
sorry to interrupt but i like to check should the configuration be persisted between two different mode run.
For example, firstly i run standalone mode and indicate my db path. The db path is save successfully into the properties file if everything is fine. I close the window. Next i run the network server mode. should
the db path i previously type in standalone mode to be show or should be empty since this is my first time running network server mode?