aspose file tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Distance between two Airports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Distance between two Airports" Watch "Distance between two Airports" New topic

Distance between two Airports

Rama Bhargav

Joined: Mar 25, 2006
Posts: 25
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.

Pl feel free to add your comments/suggestions.
Raghubir Bose
Ranch Hand

Joined: Feb 18, 2006
Posts: 88
A dumb programmer like me would first ask you ...

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? 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 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 ???

..let me know what you think about it...

I will meet the fairy queen soon !
Rama Rao Yadlapalli

Joined: May 07, 2003
Posts: 3
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.
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
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.

Good luck,

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Rama Bhargav

Joined: Mar 25, 2006
Posts: 25
Thank you Ajith. I was carried over by the CEO comments wherein he indicates the pricing is simple, varies based on destination. Now I see your point.

I have one more question. What is "four 9's"? I know 24/7 but never heard four 9's.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42954
Four 9s means 99.99% uptime (Five 9s would be 99.999%).
Rama Bhargav

Joined: Mar 25, 2006
Posts: 25
Thanks a lot Ulf.
Sreenivasa Majji
Ranch Hand

Joined: Jul 12, 2001
Posts: 224
On the side note, if you want to calcuate the distance between two airports, you just need a utility method, SLSB is just an overkill.

Sreenivasa Majji
I agree. Here's the link:
subject: Distance between two Airports