Looking back at the various
projects I have started, I am starting to see a pattern. When I use a REST API provided by a given web site, I end up writing a full-fledged client for that library if one doesn’t exist. There is something I really enjoy about writing wrapper libraries.
In any event, when the
stackoverflow.com api beta was announced, I decided to play around with it. One thing lead to another and I ended up implementing a full client library. That is where
Stacky was born (it was originally called
Stackoverflow.Net but due to some
naming concerns I renamed it). This has been a very fun project to work on and I have received some great participation and feedback from people in the community. The StackOverflow API is officially
named Stack Apps because it applies to all Stackoverflow family websites.
One of my main goals with the library was to just keep things simple. It is a simple library with a simple purpose so there is no need to be fancy or complicated. One feature introduced in c# 4 was
optional parameters. Most REST services have a certain amount of optional parameters to each method and it is often messy to model this behavior in C#. Often you end up just having a crazy
amount of method overloads. Here is a simple example of using the library:
IUrlClient urlClient = new UrlClient();
IProtocol protocol = new JsonProtocol();
var client = new StackyClient(version, apiKey, Sites.StackOverflow, urlClient, protocol);
var questions = client.GetQuestions();
foreach (var question in questions)
After creating a .Net 4 version of the library, I realized I could also support Silverlight with a minimal amount of extra effort. Then once I had the library running in Silverlight, it was another small step to support Windows Phone 7. So then I had a multi
platform library on my hands. This introduced an extra set of problems mostly having to do with making sure all the libraries are in sync and tested correctly.
After I released a version supporting these three platforms I received many requests to support .Net 3.5 so I eventually made a version for .Net 3.5 which used wrapper classes for optional parameters.
You can check out the source for Stacky here:
http://stacky.codeplex.com. I will blog more of the specifics in the next week leading up to the final release of the stackapps api.