Android/iPhone apps... Using an internet based API vs a local API
I am working on a charts application for Android. I've found some APIs that I can import in my project to draw charts. Another good option is to use Google Charts API which seems t开发者_如何学Pythono be easiest to use and more reliable than other APIs.
My question here is that if I use Google APIs, most processing is done on Google server but there may be some delay in response and hence in displaying the charts. On the other hand if I import an API into my project, it'll execute faster but it may consume more memory. So which one should be my choice and which things should be considered in choosing between internet based Google API or a local API which can be imported into my project
Ultimately it is up to you, but I will provide a small pro/con list (not comprehensive) for each below.
Local Api:
Pro:
-No network latency
Con:
-Additional memory consumption (to hold the library).
Remote Api:
Pro:
-No additional dependencies to external libraries.
-Less memory consumption.
Con:
-Potential server downtime (Planned and unplanned).
-Additional latency for creating charts.
Obviously, since you are targeting a mobile platform, there are some additional things to consider. A Remote Api may be unavailable at some times, either due to server downtime, or just a lack of a wireless network connection. Because of this, you may be pushed toward the Local Api. On the other hand, you probably want to have as small of a memory footprint as possible, since you are working with limited memory devices, which might suggest going with the Remote Api.
Again, it all depends on what you (or your business unit) find is most important for your (or your buisness unit's) app.
I'd choose the local API. Purely because not all android users will have internet access (bad assumption made by many). Second, people will be watching bandiwdth usage.
I wouldn't be worried about memory usage unless your app is large compared to other apps.
I think you have kind of answered your own question you just need to prioritize according to your users needs, application requirements, environment etc.
Speed Resources Feature Set Connection Availability and Bandwidth
Order those according to your customers requirements and I think you will have your answer.
What I never consider is what is the "easiest" for development out of the gate which seems to be the priority of a lot of developers.
Personally I avoid anything that requires a connection unless it's the only viable option, or the application itself requires it (like real time stock charting, obviously connection then becomes a requirement and can be moved down the list) because there will be times when a connection is not available
Only you and your users can determine what is important and in what order, but at least your thinking about it!
精彩评论