File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [B&S] - Need help determining a plan of action with options window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "[B&S] - Need help determining a plan of action with options window" Watch "[B&S] - Need help determining a plan of action with options window" New topic
Author

[B&S] - Need help determining a plan of action with options window

Vincent Hernandez
Ranch Hand

Joined: Oct 17, 2004
Posts: 43
Ok, here it goes, and please bear with me!

I have come to a design decision about how I want to handle suncertify.properties. Upon the commandline option passed in {"server", "alone", ""} ("" implying network client), I will prompt the user for options depending on the mode.

Server:
File Location
Port

Network Client:
Server IP
Server Port
CSR Number

Standalone Client:
File Location
CSR Number

Which leads me to 2 options:
A) create an abstract class or interface and have 3 different "option window" types that extend/implement that. A factory object can crank out the right one, depending on the mode.

B) create only one window type for options and use the mode flag to determine which fields are shown.

A sounds cleaner, but I think it may be overkill.

B sounds like less code and probably less repetitive code, but it may be messy.

What do you guys think? Any feedback is appreciated.
Murali Kurukunda
Ranch Hand

Joined: Oct 20, 2003
Posts: 36
Hi,
I guess I have questions to you rather than answers.
Prompt the user for CSR ID at the start up?
I think this may get you into trouble depending on your instructions for exam. My instructions say that CSR ID is entered for the customer id field when booking a record. So by prompting the user the at start up you are forcing only one CSR number to be used in a session. This may be an issue if a particular CSR wants to book two or more contractors for two different customers.

Apart from that I would say that your option B is simpler.

Murali
Vincent Hernandez
Ranch Hand

Joined: Oct 17, 2004
Posts: 43
I see what you mean, and yes you're right. So with that aside,

erver:
File Location
Port

Network Client:
Server IP
Server Port

Standalone Client:
File Location
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Do you really need the file location either? Is it not assumed to be the one downloaded with the assignment that is supposed to be scrictly placed in the root directory of your jar?

In regards to your first question, I would personally choose the second solution to keep things just as simple to understand as possible. As you mentioned, the first solution might be overkill (hence improperly applied) and turn off the evaluator.
Vincent Hernandez
Ranch Hand

Joined: Oct 17, 2004
Posts: 43

Do you really need the file location either?


From the instructions I have, under "network connections".


Your choice of RMI or serialized objects will not affect your grade, but no other approach is acceptable. In either case, the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely.


I understand it's under the "network connections" section, meaning the user should only specify the IP/Port location of the server if it's in Network Client mode.

I can see what you mean by your question/statement, but I will agree with you somewhat by saying that declaring the file location within the options seems like something that is optional, and that if i wanted to, not even prompt the user for such.
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Sorry about that, you are right...I checked back and saw that myself...Other than the CSR thing the rest of it does seem sensible. I am trying to minimize the options the user has to type in/select so I might hard-code the ports to 1099 (the RMI default) and state so in my design decisions.
Vincent Hernandez
Ranch Hand

Joined: Oct 17, 2004
Posts: 43
Ok, thanks for the current feedback guys, but aside from some of the brief comments, most of this has gone off into a tangent. Can I get some feedback on my original question:


Which leads me to 2 options:
A) create an abstract class or interface and have 3 different "option window" types that extend/implement that. A factory object can crank out the right one, depending on the mode.

B) create only one window type for options and use the mode flag to determine which fields are shown.

A sounds cleaner, but I think it may be overkill.

B sounds like less code and probably less repetitive code, but it may be messy.

What do you guys think? Any feedback is appreciated.


And this is my current list of options which I plan to have listed:

Server:
Port

Network Client:
Server IP
Server Port

Standalone Client:
NONE


After scanning through my instructions, I will agree with you Reza It makes better sense to reduce the amount of input the user provides as much as legally possible. Reduces complexity and overhead. For thank, thanks!

But yes, feedback on the original question is still needed. Thank you in advance!
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Just to clarify, I DO think you still need the file location input. I know it is a tangent, but I wouldn't want you to loose points over a technicality. I noticed you removed those options on your latest version.

I wasn't sure if you were looking for opinions other than mine or if you just missed it in my first post, but I would favor the second solution. Remember that clarity and maintainabilty is an important consideration in the final solution. Saving the Factory pattern for the Database client generation might be best. Creating a dialog might be a little too trivial to get too elaborate...
[ February 02, 2005: Message edited by: Reza Rahman ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: [B&S] - Need help determining a plan of action with options window