Driscoll Web Development Blog

Get information, tools, news, tips, and more from the expert web developers at Driscoll Web Development.


Thursday, January 29, 2009

Why Use the BitlyXAPI?

As you most likely saw in my last post, I've just released the BitlyXAPI .NET Library. I created this library for two reasons: first, it is my entry to the bit.ly API Contest; second, I wanted to have some fun with my .NET chops while at the same time doing something helpful for the web development community. The BitlyXAPI .NET Library is free under the terms of the GNU GPL, so clearly I'm not looking to make a profit off this nor am I attempting to prevent other developers from deriving their own libraries from it.

So, if you're a .NET developer and you're reading this, you're most likely wondering what the BitlyXAPI Library can do for you - which is not a topic that I've previously addressed in-depth. I wanted to spend some time highlighting what I believe to be the key advantages to using this library in a project that implements the bit.ly API.

The BitlyXAPI Library is Fast
Due in no small part to the fact that the bit.ly API itself is quite speedy, I've done my best to keep the BitlyXAPI Library's overhead low so that there is little (if any) perceptible difference between using the Library and calling the bit.ly API directly.

The BitlyXAPI Library is Open and Adaptable
I'm not a huge fan of most API wrappers because they often limit what you can do, so I purposefully set out to write a library that would allow developers to leverage the bit.ly API without necessarily being put into lock-step with the API's implementation. Rather, developers can use the BitlyXAPI Library as it fits into their applications rather than build applications that strictly adhere to the functionality of the library (which is, unfortunately, the case with most API wrappers). Granted, this level of adaptability does have its drawbacks; for instance, one might notice that none of the bit.ly API methods are defined in the BitlyXAPI Library - meaning that one would have to write one's own Shorten() method in their application should they choose to do so. However, I feel that the aforementioned example highlights why the BitlyXAPI Library is so great, because it potentially allows developers to easily write complex methods with the BitlyXAPI Library.

The BitlyXAPI Library is Event-based
I took an asynchronous, or event-based, model into account when I wrote the BitlyXAPI Library. It allowed me to write lean, granular, and easily maintained code in the Library itself. However, it also gives developers the advantage of writing lean, granular, and easily maintained code in their own applications. And, the event-based model gives developers the assurance that their application won't hang if a method call doesn't return a result.

The BitlyXAPI Library Handles Menial Tasks
For most, creating an application that imports data from an external resource is excruciating because so many lines of code must be dedicated to checking that the application has network access, then checking that the application can access the specified resource, then cleaning up when the resource is no longer needed, etc. Internally the BitlyXAPI checks with every call to the bit.ly API that the API is accessible to the application, and throws a BitlyException if the service is unavailable for any reason. The BitlyXAPI also performs its own garbage collection on the resources that it uses. Therefore, the developer can focus more on developing a solid application and spend less time writing code to perform menial tasks.

The BitlyXAPI Library is Well-documented
Another one of my pet peeves about many (but not all) API wrappers out there is their lack of documentation and/or working samples. Upon decompressing the BitlyXAPI Library archive a developer will notice the ReadMe.txt file along with a small sample class and console application. The ReadMe.txt file provides full documentation for the BitlyXAPI Library, while the sample class and console application allows the developer to see the BitlyXAPI Library at work - right out of the box.

The BitlyXAPI Library is Free
By "free" I don't mean "no-cost", although the BitlyXAPI Library is provided at no-cost as well. Rather, I mean that because the BitlyXAPI Library is licensed under the GNU GPL, developers are free to request and obtain the Library's source code so that they may alter it to better meet their needs, or to create an extended library from it. The only thing I request is that out of respect developers acknowledge Driscoll Web Development and/or Brian Driscoll (me) in their applications - and that they provide a link to the original BitlyXAPI Library somewhere in their application's documentation.

Now that you've read this (and assuming you're a .NET developer who's interested in the bit.ly API), I hope that you'll consider using the BitlyXAPI Library in your project. If you create an application with the BitlyXAPI Library I invite you to comment on this post with a link to your work.

The library is available for download here.

Labels: , , , , , ,