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

Basic doubts

 
Adithya Rayaprolu
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This forum is great, it helped me a lot. I am also working on FBN assignment. I have some basic questions.
1. Can I pass program mode(network/local) and database location as command line arguments? Or do I have to provide a dialog box at startup asking the user to enter the mode and location?
2. If I use comboboxes to select origin and destination, I have to get the lists of origins and destination from the database. In our case, the list is small, so this will be fine. what if the list increases? what if the list is changed during runtime?
3. There is a requirement stating that 'If an attempt is made to unlock a record that has not been locked by this connection, then no action is be taken.' This means, we have to somehow get clientID for checking. Can I ignore this? If I do not take the clientID in lock/unlock, is the grader going to fail me?
Thanks.
 
poornima sudharshan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Adithya Rayaprolu:
Hi,
This forum is great, it helped me a lot. I am also working on FBN assignment. I have some basic questions.
1. Can I pass program mode(network/local) and database location as command line arguments? Or do I have to provide a dialog box at startup asking the user to enter the mode and location?
2. If I use comboboxes to select origin and destination, I have to get the lists of origins and destination from the database. In our case, the list is small, so this will be fine. what if the list increases? what if the list is changed during runtime?
3. There is a requirement stating that 'If an attempt is made to unlock a record that has not been locked by this connection, then no action is be taken.' This means, we have to somehow get clientID for checking. Can I ignore this? If I do not take the clientID in lock/unlock, is the grader going to fail me?
Thanks.

1.I think it is better to have a frame which asks the mode of the apllication.That's how I have implemented.
2.Write a Helper class which selects all the Origin & Destination airports,You can use a Vector to add all the values,
there is no worry that the list might increase,since the vector automatically increases in size.
poornima.
 
Rick Fortier
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Can I pass program mode(network/local) and database location as command line arguments? Or do I have to provide a dialog box at startup asking the user to enter the mode and location? It is easier for the user to be prompted for this. You can do this at startup only, or allow the user to change modes without rebooting. You would certainly pass if you only used the command line argument method, but it is harder on the user.
2. If I use comboboxes to select origin and destination, I have to get the lists of origins and destination from the database. In our case, the list is small, so this will be fine. what if the list increases? what if the list is changed during runtime? Don't use a fixed length array. I am going to use a HashSet to help built the lists. I can loop through the file and add the cities, and HashSet will automatically remove the duplicates and sort it for me. If the list changes during runtime (supposing you wrote an Admin for it), then you could have a menu item which you could use for this purpose. Let the user manually run this update.
3. There is a requirement stating that 'If an attempt is made to unlock a record that has not been locked by this connection, then no action is be taken.' This means, we have to somehow get clientID for checking. Can I ignore this? If I do not take the clientID in lock/unlock, is the grader going to fail me?
Thanks.
This is not easy to do if you chose RMI. There are lots of threads on this topic. Some people are stating "When the program is used as designed, noone will be unlocking things that they did not lock", and ignoring the "current connection" phrase, and passing. Others are creating custom socket factories, which I have no idea how to do. Remember that one of the requirements is that a junior programmer should be able to maintain and understand your code. In my opinion, custom socket factories is beyond the grasp of a junior programmer. Other people have modified the lock/unlock signatures and also passed. I have a friend that actually modified the structure of the database and added a locked column. It made his code alot easier too. And he passed.
Happy coding.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rick Fortier:
It is easier for the user to be prompted for [program mode and database location]. [...] the command line argument method [...] is harder on the user.
Beg to differ there. "The user" would be a man or woman behind the counter in a travel agency who might not be able to distinguish their filenames from their hostnames. Presumably, either an IT person will install the application manually, or a set-up program will be written to perform the installation. Either way, a shell script or shortcut link should be set up to start the application with click of the mouse. A dialog is in my opinion inappropriate.
That's just my opinion though, which doesn't count for anything . Sun will happily pass you with a good grade whichever way you go, as long as you can convincingly argue your case.
[...]HashSet will automatically remove the duplicates and sort it for me.
I guess you mean SortedSet?
[Getting the clientID for lock checking] is not easy to do if you chose RMI. [...] Some people are stating "When the program is used as designed, noone will be unlocking things that they did not lock", and ignoring the "current connection" phrase, and passing. Others are creating custom socket factories [...]
To the contrary , obtaining the client ID is very easy with RMI once you get the idea that every client should get its own DatabaseConnection... RMI will give you free dead connection cleanup to boot.
The argument that a properly written client will never be unlocking things they did not lock is, erm, well, let's say that I wouldn't want any of these people's code anywhere near production environments. Not to mention that you purposely ignore an explicit requirement. I'm surprised that these people actually pass.
I agree with you about socket factories. It's unmaintainable by anyone other than Java experts, it's overkill for the purpose. If you can do custom socket factories, your Java skills must be such that you should be able to come up with something better
Other people have modified the lock/unlock signatures and also passed. I have a friend that actually modified the structure of the database and added a locked column. It made his code alot easier too. And he passed.

My impression is that as long as you carefully argue why you made a decision like that, there's a lot you can get away with.
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic