Overview
This report summarizes a pair of programming projects. I (Lin Meng) and Li yazhao jointly completed this project.
The goal of the project is to obtain the geographical location information of the user through the user's IP address when the user accesses the academic map, so as to reposition the map and set the location of the user as the center currently displayed. This function is available on many network maps, such as Bing map and Google map. After a long investigation, we finally found two solutions.
Method 1
The W3C geolocation API is a standard API provided by World Wide Web Consortium (W3C) to obtain geographical location information ). This API is widely accepted. Firefox has been supported since version 3.5. Google Chrome, opera 10.6, Internet Explorer 9.0, and Safari 5 also support this API. In addition, it is relatively simple to use. You only need to embed a piece of JavaScript.
WBS Construction
Method 2
Use the free IP-location database. Not all browsers support the W3C geolocation API, so we want to add another alternative solution that is automatically enabled when method 1 fails. We found such a free IP-location database on the maxmind website. The precision of the database on the surface of the experiment results is also acceptable, but there is still a gap with W3C.
WBS Construction
The components required by method2 are basically the same as those of 1. We use a self-written WCF Service to replace W3C geolocation API. The parts of Silverlight can be reused.
Costmethod 1
The biggest difficulty of this method is integrating JavaScript and Silverlight. The cost list is as follows:
|
Estimate |
Actual |
Javascript |
0.5 hour of Search |
Just Wiki page is OK It took 10 minutes to rewrite something similar to the Wiki example. |
Silverlight |
0.5 hour to understand how to work with JS 1 hour for the buttons and map |
1 hour about using JS, mysterious bugs 1 hour about buttons and map, even a storyboard showing a fading message when failure. |
Method 2
The difficulty of this method is to quickly find the IP-location table. The cost list is as follows:
|
estimate |
actual |
ip geolocation service |
1 hour to learn how to use service 1 hour to prepare database 1 hour to implement a fast algorithm for database lookup |
fast, WCF Service is easy to learn half a hour for a binary search in database |
Silverlight |
0.5 hour to re-use buttons and map controller of method 1 0.5 hour failure Handler and access to server |
nearly all reuse, fast |
In summary, the biggest time overhead is in the survey. We spent nearly two days looking for a valid, stable, and fast solution.
Result
Analyze the results from the following aspects:
1. Stability
ProgramStable Operation, clear handling of exceptions.
2. Accuracy
The accuracy of W3C geolocation API does not need to be questioned. The accuracy of the free IP-location database is hard to estimate. The official claim has 97% accuracy.
3. maintainability
For W3C interfaces,CodeOnce completed, maintenance is not required and data is provided remotely.
The free IP-location database is static and needs to be updated.
4. Efficiency
The W3C standard interface is extremely fast. If it fails, the static database solution will be started. We use binary search to ensure a balance between time and space consumption.
Run (the user coordinates are in the middle of the star, and the company's IP outlet is near Redmond)
Work
My Opinion on Pair programming:
There are advantages and disadvantages. Working at the same time improves our courage to overcome difficulties. At the beginning, it was very difficult to find a suitable IP service. But after drinking tea, I suddenly solved the problem. Technical difficulties can be solved in a few minutes. The bad thing is that two people have to squeeze out time, and it is best not to insert Personal Work in the middle. In one place, yatao added the code. I was not there at the time. As a result, some problems occurred during my merge code and it took a lot of time.
About my partner
A good helper at work, working with me until two o'clock AM late at night, working hard. There is nothing to improve.
Thanks,
By Lin Meng