API vs Written Code

APIs seem like a big thing now on the web.  Social media sites are releasing APIs all the time, and this benefits them as well as  yourself.  The question to be asked is an API better then code that you wrote yourself?  The anwser is both yes and no.

For those who don’t know want an API is,  Wikipedia defines an API as “a set of routines, data structures, object classes and/or protocols provided by libraries and/or operating system services in order to support the building of applications.”   Some of the larger and better known APIs are developed by Google.  Two of Google’s more popular APIs are their Map API, and custom search APIs.

So what is better, your own written code or an API?  Well that all depends on your code and what you want your site to feature.  If you want your site to have an interative map, then Google’s Map API will benefit you greatly.  In this would help you from having to create your own interface for a map software just to get the job done.  It can also increase the functionality of your site, by embeding the map into your code rather than having to send the user to a different page to get the same information.

Another useful API is Akismet that comes default with WordPress.  This API is designed to stop spammer in your WordPress comments.   This is another useful API which helps you moderate your site quickers.

On the other hand, code you write yourself you have more control over how it functions.   There are times when this benefits your needs more then an API.  An example of this type of functionality is if you were using Facebook’s API to get your account name from Facebook.  This would be better written into your code.   Where as if you were getting your Facebook status, your friends, and other variables which could change, then an API would be better.

There are some ways to determine if an API should be used over your own written code.

1.  Will the API make maintance on your site decrease?

2.  Will the API add any additional benefits?

3.  Can you code a similar feature quicker?

4.  Is it not possible to have your feature without an API?

The final choice is up to the person coding the site.  APIs are nice and very useful, but sometimes doing the job yourself gets better results.

Leave a comment