How is the distance between two airports obtained? As far as I could see, there are 2 options
1) Distance is calculated based on the co-ordinate/location of the two air-ports. So, in this option, there will be a SLSB which will take the location specific details of two air-ports, calculate the distance. Pros : easy to maintain Cons : consumes a few CPU cycles/time every time we need to calculate the distance. This could be improved by introducing server level caching though.
2) Database will have distances between all possible combinations of air-ports. Pros: Better performance Cons : Maintanance nightmare for DBA, as for evey new air-port, we have to get the distance between this air-port to all other air-ports in the database and make an entry in DB. Since we do not get to add a new air-port often, so it should be OK.
1. When you say co-ordinates what is my (0,0)?.So to find out the distance between two points from point A to point B what would be my minimum path?...man you are asking me to solve a critical path problem...
I am just not qualified enough .. get somebody else
2. If the min distance between two points(which normally does not change) is kept in a DB, I would look for a session bean which can query an entity bean which refers to a table containing point A ref, point B ref and distance(a primitive).I can find the ejb ...easily...!! and use the session bean ( which should be stateless) to get my results ..go home and sleep happily in my couch
Now if you say ..you should know that the number of rows are too many !! .. I would say .. then why do you have an EJB container ???Those guys should take care of it ...right ???
Thanks a lot Bose. I am in agreement with you, not because it is difficult to program the distance between two points, but for the better performance. And also due to the fact that we don't get to add new air-ports probably in years.
I am not sure why you need this to solve the assignment? If it is to calculate the fare, remember that the fare has no bearing on the distance. A trans-continental flight from NYC to LA can cost less than a commuter flight from LA to Las Vegas. Pricing is complicated and your assignment is not expected to address that. In real life, pricing depends on various factors such as how soon you book, how full the is the flight, the class, the time of the year and so on.
Read your requirements. Solve what has been asked for.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).