• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design Questions

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
I have a few questions in my design. Please comment on them.
1. I have completed my lock and unlock. Not sure how to test it. When I try to run 2 clients, they run fine initially, but after a few bookings, both the UIs freeze. Why does this happen? Does this mean there's some problem with my lock/unlock?
I have defined my lock and unlock in Data class. But in my lock and unlock I refer to the HashSet (set of locked records) that is inside my Connection Code. Is this ok?
2. When I start my client, I just say "java client" (no mode specified at the start-up) and once the GUI comes up only, the user is allowed to choose either "local" or "remote". Is this fine?
3. Do I need to make the table cells editable, since the users are not going to modify the table anyway?
For the table to reflect changes, I call the model object that would fetch the latest results from the DB and do table.setModel(model). Changes are reflected. Is this ok? Or is there any better way of doing this?
4. For the local Data class version, I have a LocalDataImpl (has a data object inside)that implements RemoteInterface (that has all the public methods of Data). All the method calls are passed to the Data class. This class takes care of the "local" access. My program is going to work even when I make my Data class implement this interface and take care of the local access. I feel the former way is better since that way I can have my Data class undisturbed.
5. In my GUI, do I need to make room for a "detailed" search like a text field for the user to enter the criteria, Carrier='SpeedyAir',Origin='SFO'???
6. I am using a mix of Border, Flow and Grid layouts in my GUI. So I want to restrict the size of my main frame. Else, when modified, my components assume funny sizes. Is it a good idea to restrict the frame size?
7. I bind a factory object to the registry. So each client gets a new connection object. Are there chances for the factory to reuse the connection object for another client?
Thanks
Nandini
 
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Nandini,
Try to break down your questions in small related threads. I did the mistake of posting a large number of broad and unrelated questions and nobody replied until Phil politely pointed out that I can be more specific.
Just a thought.
Regards.
Bharat
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for pointing it out to me, Bharat. I will take care not to repeat this.
I have re-framed them in an orderly way.
Networking questions
1. When I start my client, I just say "java client" (no mode specified at the start-up) and once the GUI comes up only, the user is allowed to choose either "local" or "remote". Is this fine?
2. For the local Data class version, I have a LocalDataImpl (has a data object inside)that implements RemoteInterface (that has all the public methods of Data). All the method calls are passed to the Data class. This class takes care of the "local" access. My program is going to work even when I make my Data class implement this interface and take care of the local access. I feel the former way is better since that way I can have my Data class undisturbed.
3. I bind a factory object to the registry. So each client gets a new connection object. Are there chances for the factory to reuse the connection object for another client?
4. I have completed my lock and unlock. Not sure how to test it. Can I open 2 client windows and do the testing. I tried inserting Thread.sleep(), but when I tried to work on both the clients' bookings alternately, the UIs froze.
I have defined my lock and unlock in Data class. But in my lock and unlock I refer to the HashSet (set of locked records) that is inside my Connection Code. Is this ok?
User-Interface questions
1. Do I need to make the table cells editable, since the users are not going to modify the table anyway?
For the table to reflect changes, I call the model object that would fetch the latest results from the DB and do table.setModel(model). Changes are reflected. Is this ok? Or is there any better way of doing this?
2. In my GUI, do I need to make room for a "detailed" search like a text field for the user to enter the criteria, Carrier='SpeedyAir',Origin='SFO'???
3. I am using a mix of Border, Flow and Grid layouts in my GUI. So I want to restrict the size of my main frame. Else, when modified, my components assume funny sizes. Is it a good idea to restrict the frame size?
Regards
Nandini
[ August 13, 2003: Message edited by: Nandini Sriram ]
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini

1. When I start my client, I just say "java client" (no mode specified at the start-up) and once the GUI comes up only, the user is allowed to choose either "local" or "remote". Is this fine?


That's what I did.

2


Was there a question there?

3. I bind a factory object to the registry. So each client gets a new connection object. Are there chances for the factory to reuse the connection object for another client?


Not of it's own accord. You would have to write your factory to reuse connection objects. This would be a very good idea in a real world situation, but for the purposes of the assignment you might want to avoid this as it will make your code more complex.

4. I have completed my lock and unlock. Not sure how to test it. Can I open 2 client windows and do the testing.


I don't think that would be a good idea. There is a limit on how fast you can click on the two client windows, so you could not accurately simulate 100s of users clicking simultaneously. I would recommend you create a test application (or a suite of test applications) to test this properly. Just create threads which simulate client actions without having the user interface.

I tried inserting Thread.sleep(), but when I tried to work on both the clients' bookings alternately, the UIs froze.


Did the UIs freeze because of the sleep or because of something else in your code?

I have defined my lock and unlock in Data class. But in my lock and unlock I refer to the HashSet (set of locked records) that is inside my Connection Code. Is this ok?


How are you doing this? There are some ways that you could do this that might be OK, and some ways that would be very wrong.
Does this mean that a user cannot call your lock() and unlock() methods without doing some other outside work first?

Do I need to make the table cells editable, since the users are not going to modify the table anyway?


That is up to you I didn't.

For the table to reflect changes, I call the model object that would fetch the latest results from the DB and do table.setModel(model). Changes are reflected. Is this ok?


Sounds OK

In my GUI, do I need to make room for a "detailed" search like a text field for the user to enter the criteria, Carrier='SpeedyAir',Origin='SFO'?


I would recommend you stick to offering the user choices in a pull down list. Dont let them enter search criteria manually.

I am using a mix of Border, Flow and Grid layouts in my GUI. So I want to restrict the size of my main frame. Else, when modified, my components assume funny sizes. Is it a good idea to restrict the frame size?


I would advise against restricting frame sizes. You run the risk of the user running on a different platform than you developed on, the specified size not displaying properly, and the user cannot do anything since they cannot resize.
Perhaps you should rethink how you are doing your layouts so that you dont have so many problems when people resize. I know with my setup, when I resized my screen the only thing that changed size was the JTable. And I did not have any restrictions on object or frame sizes.
Regards, Andrew
PS: Way too many questions for one post :roll:
 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Nandini,
Here are my two cents:

2. For the local Data class version, I have a LocalDataImpl (has a data object inside)that implements RemoteInterface (that has all the public methods of Data). All the method calls are passed to the Data class. This class takes care of the "local" access. My program is going to work even when I make my Data class implement this interface and take care of the local access. I feel the former way is better since that way I can have my Data class undisturbed.


Do you have Max's book? Please take a look at the DVDConnector object discussed on page 182 of his book. If you follow that logic, you can pretty much use the same code for local as well as remote connections. If your "LocalDataImpl" class is analogous to his "DVCConnector" then you are on the right track.
Regards.
Bharat
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Bharat,
Thanks. Unfortunately I don't have that book. So I'm not sure what the DVDConnector does.
My LocalDataImpl class has been created for local access alone. First I thought of extending the Data class and make that implement the remote interface. Then I decided against it, and so I have created another class for local access. As I had already mentioned, I can make Data implement that interface. But I want to leave it as it is. Is this correct?
Thanks
Nandini
 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Nandini,
Before I can answer your question with any confidence, I will need to know what is it that you have in your LocalDataImpl class and how does it interact with the Data class. Can you post snippets of your code?
Bharat
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Bharat,
Here is my LocalDataImpl. RemoteIF is the remote interface that has all the public methods of Data.

My DataClient is going to call this class in case of local access.
Thanks
Nandini
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Andrew and Bharat,
Thanks a lot for bearing with my long list of questions posted yesterday. I will take care to keep it short.Please take a look at this Test Client case. Initially, I have attempted to make 3 client threads lock record no:1 (has 50 seats)and book 3 seats in that flight.

This is the output:

When I increase the number of threads, or even when I run this program again, I get a different output. I don't get the required number of seats booked. My server is also getting locked up after this. Any further requests for this record - it says "please wait ..", which in my code means the new requests are inside the wait call of the lock method.
Is there a problem with my lock / unlock or a problem with my LockTest code? When I try for random record numbers, it seems to work fine.
As for my lock/unlock, I maintain a HashSet of locked records in my connection code (RemoteData). And I call my wait and notify methods on that set inside my lock and unlock in Data. Is this allowed?
In my lock() for example, it is like this:
if (RemoteData.locked == true) {
synchronized (RemoteData.lockedRecords) {
try {
RemoteData.lockedRecords.wait();
}
catch (Exception e ) {e.printStackTrace();}
}
}
Since my connection object is going to be unique for each client, I chose not to synchronize the methods inside that class. Is this correct?
Thanks
Nandini
[ August 14, 2003: Message edited by: Nandini Sriram ]
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini
The code you provided for testing looks OK (as far as it goes) so I suspect that the problem is with your server code.
By the way it looks like you have an instance of the Data class for each connected client. Is that correct? Have you modified Data class so that creating new records will work in this scenario? Do you think this is allowable? Have you considered that the inbuild synchronization on methods in the Data class may no longer do anything for you?

In my lock() for example, it is like this:
if (RemoteData.locked == true) {
synchronized (RemoteData.lockedRecords) {
try {
RemoteData.lockedRecords.wait();
}
catch (Exception e ) {e.printStackTrace();}
}
}


The code snippet you provided does not appear to be correct. When the waiting thread gets woken up, it does not appear to recheck whether the record is now available or not.
Regards, Andrew
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Andrew,
Thanks a lot.
About a single instance of Data, this is what I'm doing:
Inside my FactoryConstructor, I have a data object created. And then this is passed to the RemoteData class via getConnection() - I make this method return " new RemoteData(data). "
In my RemoteData(Data data) constructor, I pass all the method calls to data. Since all the clients are going to look up to just one FactoryObject, I thought all of them would have just one Data object too. Is my understanding correct?
Please take a look at my lock and unlock:

My server no longer gets locked, but the required number of seats are not booked. This is the message on my server when I run 5 concurrent threads:
Record Locked
Please wait...
Please wait...
Please wait...
Record number 1 unlocked
Record number 1 unlocked
All 5 threads finish running, but sometimes less than 5 seats are booked.
Please guide me where I go wrong.
Thanks
Nandini
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini
I cannot work out where the problem is from your psuedocode. Although, as I mentioned earlier, it appears that you do not have your check to see whether a record is currently locked inside a while loop.
Regards, Andrew
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Andrew,
I have a doubt in the start-up of my application.
Right now, I just let the application start, and then the user is allowed to choose a mode.
I use a fillComboBox() method to fill the origin and destination comboboxes. For this, I am using the dataAccessObject, which will get initialized only when the user chooses a mode of access.
What happens now is this - with the start-up of the application, the comboboxes are empty, and once the user is done with the mode selection, the boxes get filled up. It looks odd to me. I need your opinion on this. Another way is to start either in the local or remote mode.
Please suggest to me which would be better.
Thanks
Nandini
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nandini,
I assume, you are letting the user choose the mode somewhere in the main window. If i am correct, i'd suggest, you pop up a dialog box for the user to choose the connection mode and only after the mode is decided, you display the main window with the combo boxes filled with records.
Regards
badari
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Badari,
Thank you for replying.
You are correct. I am letting the user choose a mode in my main frame only. I thought it'd save me a dialog. Moreover, I thought it was mandatory for the user to switch modes inside the GUI, and that would be more convenient too. And hence my design!!!
But here, as I told you earlier, the combos are empty intially when my GUI comes and then gets filled with the mode selsction. Is there a good way to overcome this?
Thanks
Nandini
 
badari gururaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nandini,

Moreover, I thought it was mandatory for the user to switch modes inside the GUI


Are you sure about switching modes AFTER THE APPLICATION HAS STARTED. My instructions clearly said
The user must be able to select the operating mode, although it is acceptable that the program stay in one mode once it has started up.

If this is true in your case, a start up dialog could solve your problem. If you are not willing to use a dialog for some reason, you can make the network params as arguments for starting up the client.
If your instructions do ask you to let the user change mode after the application has started up, you can let the user change modes in the main window, but allow the user to select the mode initially by either of the above methods.
cheers
badari
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Badari and Andrew,
Thank you for bringing to my notice certain things.
I went through my spec again. It says "The program must allow the user to specify the location of the database, and must also accept an indication that a local databse is to be used, in which case, the networking has to be bypassed entirely".
Here's what I have done till now:
I let the application start in Local Mode and then allow the user to switch mode if he\she wants.
Also in my client code. I am hardcoding the database name i.e.,
DataClt data = new DataClt ("db.db"); The db.db is going to be in the root directory.
Is this wrong?
"The user must be able to specify the location of the database". Does this mean I need to let the user enter it as "C:\myjava\db.db"?
Another question: Can my Design Documentation (major design decisions)be in HTML or only txt?
Please help.
Thanks
Nandini
[ August 27, 2003: Message edited by: Nandini Sriram ]
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini


"The program must allow the user to specify the location of the database" [...] Does this mean I need to let the user enter it as "C:\myjava\db.db"?


Yes.
I allowed the user to manually type in a path such as you indicate, or use a JFileChooser to browse to the correct location.


Another question: Can my Design Documentation (major design decisions)be in HTML or only txt?


Check what your instructions allow you to do.
My instructions allowed me to use HTML for the design decisions document.
Regards, Andrew
 
badari gururaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
My instructions said,
You may choose between using RMI, or using serialized objects over TCP socket connections, to implement the database network communication. Your choice here 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
My inference of this was to let the user specify where the database is located i.e where on the network the database is located. That means the machine name where the server is running.
cheers
badari
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree badari.
When you run your application, will use three choices:
1. use "server" flag to starts up the server.
2. use "alone" flag to start up the client in non-networked mode.
3. use none flag to start up the client in netwoked mode.
Since the mode is choiced in command line, why you choice it in GUI again?
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Badari,
I think you missed the "In either case" issue. That is, in both local and remote mode, the user has to be able to select the location of the database. In local mode, it could be by typing in the location of the physical file on disk. In remote mode, it can be as you suggested: entering hostname / port number.
Regards, Andrew
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Leo,
Nandini is doing a different assignment to you - he is doing "Fly By Night Services", which has different instructions about how the application can be started.
In particular, FBNS does not mention executable jar files at all, but it does mention the only command line parameters that are allowed to be entered. For FBNS you cannot enter the options "alone" or "server".
Regards, Andrew
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Andrew and Badari,
Please take a look at my design now.
I have the user enter either in local or remote mode. Once the application is begun, the user can still switch modes. I have provided a text field for the user to specify the database location (like c:\myjava\db.db).
I have 3 panels inside my main GUI - Mode, Reservation, Display (online help included).
I have a userguide.html in the /suncertify/clientside directory for the online help, and design choices doc and README.txt in the root directory.
In my reservation panel, I have a combo-box for passenger(s) in addition to origin and destination. Here the user can choose the number of passengers.
While booking, the user is not asked separately as to how many are travelling.
Is this ok?
This is my package structure. Please tell me if it looks ok.
suncertify\clientside
Main GUI
DataClient
suncertify\serverside
Factory
Connection
All remote interfaces
suncertify\db
Data
DataInfo
FieldInfo
LocalDataImpl
DatabaseException
I am yet to "jar" the files. How many jar files am I allowed to create?
Please guide me as to how I can do it.
In my README.txt do I need to explain how to run the application in
other platforms also?
While importing packages, do I need to mention the full package(java.awt.Color)or can I just mention it as java.awt.*;
Thanks
Nandini
 
badari gururaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nandini,

In my reservation panel, I have a combo-box for passenger(s) in addition to origin and destination. Here the user can choose the number of passengers.
While booking, the user is not asked separately as to how many are travelling.
Is this ok?


What will you do if a flight has 200 seats available? will you put 200 seats into your combo box?

In my README.txt do I need to explain how to run the application in
other platforms also?


I dont think that is necessary. I mentioned the JDK version and the Operating System on which the application was developed. All my instructions were for this OS. I did not loose any marks for Documentation.

While importing packages, do I need to mention the full package(java.awt.Color)or can I just mention it as java.awt.*;


I am not sure it affects the performance of your code someone else may be able to comment on that. But i believe, having the full name of the class in the import statements makes the reader of the code easily understand what classes have been used. I imported around 43 classes in my main GUI class and listed all of them...it was lengthy but made reading very clear. If you do want to import like this, make sure you organize them according to their packages.
cheers
badari
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini
Sorry, missed your post earlier.
I agree with all Badari's comments except for...

I am not sure it affects the performance of your code someone else may be able to comment on that. But i believe, having the full name of the class in the import statements makes the reader of the code easily understand what classes have been used.


Personally I don't look at import statements if they are too long. If I can see that all the swing and awt packages are imported, then I know that this class is likely to be a display class. Whereas if it imports just java.awt.event then it is likely to be just a controller class.
The other problem is that anytime anything gets changed in your class, you have to revisit the list of imports if you want them to provide meaningful information. So if you change a JLabel to a JTextField, I would then have to determine if I still use any JLabels in my class, and if not, remove the import for it (not to mention adding the import for JTextField).
I read in one of Sun's documents that they recommend listing individual objects until you have more than 3 objects from a package, at which point change to importing the package. Unfortunately I cannot find the reference any more.

How many jar files am I allowed to create?


As many as you like. There are no limitations specified by Sun.
Regards, Andrew
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Andrew and Badari.
I have a question regarding booking tickets. I agree with you in saying a flight can have 200 seats available. But no airline is going to give all the 200 seats to just 1 client at one shot. The group must do it as 2/3 bookings if they want say,30 seats. So I give the maximum number as '10' for passengers.
I have the JAR files the following way. Please tell me if I have missed out anything.
scjda.jar
|
|----server.jar (all class files of the server side)
|----client.jar (all class files of the client side)
|----source.jar (all .java files)
|----db.db
|----README.txt
|----DesignDoc.txt (design decisions)
|----DesignDoc.htm (the same in HTML format)
|----userguide.txt (user's manual - have a userguide.html in the clientside package for online help)
|----"Original" folder containing all unmodified files (obtained from Sun)
|----"suncertify" package
As I had already mentioned, I have 2 packages that contain classes related to Database Access (suncertify.db & suncertify.server).
I just saw in the requirements the following line:
Any additional classes you create that are related to database should be placed in the suncertify.db package
Does this mean I cannot have a separate suncertify.server package?
Thanks
Nandini
 
badari gururaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini,

I agree with you in saying a flight can have 200 seats available. But no airline is going to give all the 200 seats to just 1 client at one shot. The group must do it as 2/3 bookings if they want say,30 seats. So I give the maximum number as '10' for passengers


Agreed. What if the flight the user searches has more than 10 seats available? Does your Instructions restrict the user not to book more than 10 seats?
This is what my instructions said

The user must be able to book one or more seats on a chosen flight. If the flight cannot provide those seats, the user must be informed. It is not necessary to provide for live updates on multiple clients when new bookings are made at other clients


It never restricted the user to book a certain number of seats.
All i am saying this is "Stick to the instructions given to you". If your instructions has such restrictions, fine. The alternative could be to have a Text field which accepts the number of seats to be booked. Yes, such a solution would need a bit of validation.

Does this mean i cannot have a seperate suncertify.server package?


Yes you can have a package like this, because your instructions are to place any database related classes in suncertify.db package and not the server or connection related classes.
Cheers
badari
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Don't we have to include the javadoc documentation files(I mean the .html files created using javadoc utility) in the final submission.
Also do we have to include the skeleton with the server jar though it is not used?
Thanks,
Meena
 
badari gururaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Yes Meena, you have to include the html files created usign javadoc.

Also do we have to include the skeleton with the server jar though it is not used?


Skeleton??. Dont create it at all. Use rmic with an option for creating stubs only.

cheers
badari
 
Meena Pitchiah
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Badari,

Thanks for the information.


Skeleton??. Dont create it at all. Use rmic with an option for creating stubs only.


Is it Ok if I don't include the skeleton in the final jar. Since I already packaged and tested everything that way. Option -v1.2 is the only option which creates stubs for Java 2 stub protocol version. Is that right?
thanks,
Meena
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Meena,
I certainly did not include skeletons in my submission.
We are supposed to be programming for the Java 2 platform, and we are told that we have to use swing components. So catering for older JVMs is not needed (IMHO).
Regards, Andrew
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Andrew and Badari,
Please take a look at my final design.
Server-side classes
Connection class and a factory class (implementing RemoteIF and FactoryIF respectively)to track the clients, identify client disconnects and implement the unreferenced to unlock the records locked by abnormally disconnected clients. I have not handled dead-locks. I have documented it saying that my client is going to book in this fashion -lock/modify/unlock.
Tested my locking using a LockTest class. To my knowledge, it works fine.
All abnormal disconnects are detected and properly unlocked by the server. No unending wait by the clients for that record.
LocalDataImpl class implements remoteIF takes care of the "local" access and here, there's no locking. This is inside the suncertify.db package.
Client-side classes
DataClient and GUIclass.
GUIclass calls the data client object to open the database.
Dataclient class has methods to open it remotely and locally. Booking method is on the client side.GUI has the mode, reserve and the display panel.
Documenting /README.txt
1. I have specified in my README.txt to run it as a jar file. Can I also make it run as a class file?
2. Do I need to mention a word about starting the registry in README.txt, or just the server and the client start-up?
3. Do I need to document the use of access modifiers in my design, I mean, why I have used them the way I have?
4. I'm making a mention of the java version in my README.txt. Do I need to do it anywhere else? Btw, 1.4 is acceptable, right?
5. I have all the modified classes inside the "suncertify" folder, and all the original classes in the "original" folder. So while submitting the original classes (without modifications) that I received from
obtained from the Sun, do I need to correct the Javadoc comments in them too or submit them as they are.
Packaging
scjda.jar
|
|----server.jar (all class files of the server side+javadoc HTML files)
|----client.jar (all class files of the client side +javadoc HTML files)
|----source.jar (all .java files)
|----docs.jar (all classes -javadoc files)
|----db.db
|----README.txt
|----DesignDoc.txt (design decisions)
|----DesignDoc.htm (the same in HTML format)
|----userguide.txt (user's manual - have a userguide.html in the clientside package for online help)
|----"Original" folder containing all unmodified files (obtained from Sun)
|----"suncertify" package
1. I read in some post that a candidate was failed because he did not have the source files in the required location. In my case source.jar contains the source files. Apart from this, the suncertify package also contains the source files. Am I correct in doing this way?
2. Should the original files (that were given by the Sun) be as a JAR file or can it be in a folder like what I have now?
Commandline arguments
My command line to start up the server and client is java -jar client.jar and java -jar server.jar (with proper arguments ofcourse). Is this fine? I don't include policy files etc.
Uploading
1. Do I need to follow any naming conventions for my final .JAR file?
2. Do I need their permission to upload my assignment or can I directly go certmanager and 'upload'?
General
Please tell me if there's anything to review before submitting my design. Any specific concept where I might have gone wrong?
Thanks
Nandini
[ September 10, 2003: Message edited by: Nandini Sriram ]
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini

1. I have specified in my README.txt to run it as a jar file. Can I also make it run as a class file?
2. Do I need to mention a word about starting the registry in README.txt, or just the server and the client start-up?
3. Do I need to document the use of access modifiers in my design, I mean, why I have used them the way I have?
4. I'm making a mention of the java version in my README.txt. Do I need to do it anywhere else? Btw, 1.4 is acceptable, right?
5. I have all the modified classes inside the "suncertify" folder, and all the original classes in the "original" folder. So while submitting the original classes (without modifications) that I received from
obtained from the Sun, do I need to correct the Javadoc comments in them too or submit them as they are.


  • My apps could run from the jar file or you could unpack the jar files and run from the class files. But I said in my documentation that the later was unsuported
  • I said in my README.txt that the registry would be started from the server. In my user documentation for the server I described what would be necessary to run the server with an external registry and/or to allow other applications to run using my inbuilt registry.
  • I didn't.
  • I only mentioned Java and OS versions in my README.txt file. I was explicit about the version numbers though - right down to build numbers.
  • We are told that we have to provide javadoc for all submitted classes, so I updated the javadoc in the supplied classes.


  • 1. I read in some post that a candidate was failed because he did not have the source files in the required location. In my case source.jar contains the source files. Apart from this, the suncertify package also contains the source files. Am I correct in doing this way?


    Why do you have it twice?
    As long as you have the source files included, and you describe where and what they are in your README.txt file, you should be OK.

    2. Should the original files (that were given by the Sun) be as a JAR file or can it be in a folder like what I have now?


    I think the folder is fine.

    My command line to start up the server and client is java -jar client.jar and java -jar server.jar (with proper arguments ofcourse). Is this fine?


    That's all I had. I didn't even require any arguments - everything worked with just those command lines you mentioned.

    I don't include policy files etc.



    1. Do I need to follow any naming conventions for my final .JAR file?


    Yes, when you go to do your upload you will be given instructions on how the file should be named. You can do that now - you will get the instructions before you get to the real upload screen.

    2. Do I need their permission to upload my assignment or can I directly go certmanager and 'upload'?


    I have not heard of anyone being able to upload without first contacting Sun. You could always try it and if you can upload let us know
    Regards, Andrew
     
    Nandini Sriram
    Ranch Hand
    Posts: 132
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hai Andrew and Mark,
    Thankyou very much. I am glad that I discovered my mistake before I uploaded my assignment. I'm continuing yesterday's discussion in this thread, since this would be more apt.
    I am handling the "any" on my client-side. I am constructing the criteria string for the various options (using 'any')and passing the call to criteriaFind(). Andrew, why I chose '*any*' was one - it could be the first item on the combo box, ('any' is pushed to the last position)and second - I thought the wildcard feature could be done with any word /character.
    To stick to the requirements, I think I'd go ahead with 'any'.
    Since I am handling this on the clientside, the server classes needn't worry about this, right?
    Here's my clientside design. Please comment if you find anything amiss.
    DataClient
    |
    |----suitable constructors for networking
    |----all public methods of Data
    |----book() that does lock -modify-unlock
    This class helps in diverting calls depending on the mode. It sees to it that lock-modify-unlock is done by the same client.
    FBNclientUI
    |
    |----mode-panel class (for switching modes inside the GUI)
    |----reserve-panel class (combos and search/cancel buttons)
    |----display-panel class (table and book button)
    |----tablemodel class (extends AbstractTableModel)
    The constructor of the main clientUI class instantiates all the classes and is responsible for the GUI.
    The display panel has the JTable and uses the setModel(model)for the results display. The display class passes the call to book() in the DataClient class.
    The model class is responsible for the display of results and updates on the table.
    Thanks
    Nandini
     
    Andrew Monkhouse
    author and jackaroo
    Posts: 12200
    280
    Mac IntelliJ IDE Firefox Browser Oracle C++ Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Nandini,

    Andrew, why I chose '*any*' was one - it could be the first item on the combo box, ('any' is pushed to the last position)


    Is this because you are adding 'any' to your tree set and then populating your JComboBox from the tree set? There are at least two ways around this particular problem that I can think of.
  • changing the sort order of the tree set
  • adding the items to the JComboBox manually instead of via the constructor


  • I thought the wildcard feature could be done with any word /character.


    Normally I would agree. But Sun had the "any" inside quotes, so I think it is safest to go with that specific string as the wildcard.
    Regards, Andrew
     
    Nandini Sriram
    Ranch Hand
    Posts: 132
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,
    In my final submission, can I leave certain print statements as they are?
    For eg.,when tickets are booked, the server prints "Record number N locked"
    and "Record Number N unlocked" or when a remote client disconnects, it prints "unreferenced called". Though I added these statements to debug, I thought why not leave them as such in my final submission?
    Any chances of the examiner getting annoyed by these statements on the server???
    Please advise.
    Thanks
    Nandini
     
    Andrew Monkhouse
    author and jackaroo
    Posts: 12200
    280
    Mac IntelliJ IDE Firefox Browser Oracle C++ Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Nandini,
    I am not sure. My personal feeling is that they should be removed (or better yet, converted to log messages).
    If the server application was running on the terminal of the server, all I would want appearing on the terminal is warning or error messages, and even then only if the warnings and errors were also going to a system log. I would not want to have missed a critical message because it was lost amongst thousands of informational messages.
    Likewise the client probably does not want to see all the messages in their DOS or shell window (assuming they even have a DOS or shell window).
    In a professional application that I was delivering to a customer, I would not have informational messages going to the command line. And I think the submission to Sun should be treated as though we were delivering a professional application to a customer.
    As an aside: you really should open new topics, rather than just adding to the end of an existing topic. This question could easily have stood on it's own, and more people would be likely to look at a stand alone question than read through this long topic.
    Just my thoughts. Anyone else?
    Regards, Andrew
     
    We noticed he had no friends. So we gave him this tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic