aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Database design, Please comment !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Database design, Please comment !!" Watch "Database design, Please comment !!" New topic
Author

Database design, Please comment !!

Abhinav Anand
Ranch Hand

Joined: May 02, 2002
Posts: 113
Hi guys,
In my FBN implementation I am using two databases to implement the feature of flight booking and flight listing requirement of the assignment.
They are:
1. db.db
This database is being used as a master database. No one ever tries to modify this database. Basically it is used to determine flight schedule and total capacity of the flight when a client querys the database.
2. scheduledflights.db
This database is used for reservation purpose only. Any reservation made on a particular date is noted down in this database. So in future if any client tries to book a seat on the same date in same flight then this database is referred to determine the current availability of seats.
Suppose while querying the scheduledflight.db database if no record exits for a particular flight on a particular date then this means that no one has ever booked a seat on that flight on that date till now. So, the bookinglogic part of my client locks the whole scheduledflight.db database and adds a new record for that purpose. Now in future any other client can refer to this record to acertain the current availability of seats and book a seat by locking the concerned record and then modifying the record.
I would like to know your suggetions and tips regarding this design, so please do comment.
Any suggetions are welcome.
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
I feel that Part 2 is out of scope and I wouldn't do anything out of scope.
Kevin Thompson
Ranch Hand

Joined: May 04, 2001
Posts: 237
This is my take on "database design". (granted, I am still working on my coding yet, and not finished with the project.)
This is my reality:
01. There is one input file.
02. Records are never added or deleted on this one input file. They are only modified slightly -> only one field is updated, and that is the "available seats" field.
Irregardless of running from the client side, or the server side, the above reality is true for any & all circumstances.
I don't think changing one field on one input file needs to be "designed". I am curious if this is how other people see it?
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Originally posted by Kevin Thompson:
I don't think changing one field on one input file needs to be "designed". I am curious if this is how other people see it?

With the existing API, you will be updating all the columns in a row and I wouldn't modify to change only one column (available seats) in one row.
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
i definately go with sai


SCJP, SCJD.
Abhinav Anand
Ranch Hand

Joined: May 02, 2002
Posts: 113
Hi,
I feel that I am the only one in this group to implement the database part in this way. Pardon me guys, but I really don't understand how can I implement reservation by modifying the base database like db.db, so please explain the same to me.
I beleive that we must provide reservation on different dates on different flights. And we have to maintain a log of each and every of them which includes the total number of seats currently available on each of them. So I need a different databasae to handle this operation.
Modifying the database part will simply update the total seats counter but how can you provide service for flights on different dates, by modifying a base database like db.db
Any suggetions are welcome.
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
I really don't understand how can I implement reservation by modifying the base database like db.db
You do a find -> lock -> modify -> unlock.
I beleive that we must provide reservation on different dates on different flights. And we have to maintain a log of each and every of them which includes the total number of seats currently available on each of them. So I need a different databasae to handle this operation.
Modifying the database part will simply update the total seats counter but how can you provide service for flights on different dates, by modifying a base database like db.db
Any suggetions are welcome.

The requirement doesn't mention any thing about dates. Why bother? Remember, you are doing the assignment to the spec and to pass.
Abhinav Anand
Ranch Hand

Joined: May 02, 2002
Posts: 113
Hi,
OK I agree that it is not in the spec. so one can pass without doing anyting about reservation on different dates.
But as far as I remember the last section of the instruction says:
"Some part of the the specification have been delibrately left out and issues unraised, you ability to think through realistically imperfect specifications is what you being graded for..."
So, this is the main reason I did it. I assumed that the question maker delibrately left out this portion of the specification for us to think about and implement.
Any suggetions are welcome.
Kirk Maze
Ranch Hand

Joined: May 14, 2002
Posts: 32
I'm with you Vishal, this database is in dire need of normalizing. However, I think it's risky (on my project at least)to modify the database. My instructions include the following "The suncertify/db directory in this distribution also contains your database file, "db.db". You may not modify this file". It may be wise to try to discover forgotten requirements, but I think it's a mistake to disregard explicit instructions. So the JavaVirtualDatabase I've already written, will have to go unused in this project.


Sun Certified Java Developer<br />Sun Certified Java Programmer
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Database design, Please comment !!