Marco Tabini has posted some of his thoughts about web application development, specifically in dealing with the creation of APIs for your site.
Unfortunately, the vast majority of websites are still built with the old "web-only" approach in mind-which, in today's world, introduces by-design limitations in what your software can do. [...] To be sure, even if you - or, more likely, someone before you-has made the decision of designing "one big ball of code" from which you now have the unenviable task of extracting a viable API, there are solutions that can help make that process easier.
He recommends a slightly different approach - building up from the API rather than working one in like it was another feature. This allows you to create a true separation between the functionality of the site and the frontend without having to do work-arounds or duplicate code in different spots. He notes that APIs should be platform agnostic and that they can also help to reduce the points of vulnerability in your application by routing the requests through a single place.