• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Distance between two Airports

 
Rama Bhargav
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?...man you are asking me to solve a critical path problem...

:roll:

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

..let me know what you think about it...
 
Rama Rao Yadlapalli
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Rama Bhargav
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Four 9s means 99.99% uptime (Five 9s would be 99.999%).
 
Rama Bhargav
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Ulf.
 
Sreenivasa Majji
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic