|
There is some discussion over wether to support XML-RPC interfaces for the new Necho API, or to just provide REST as protocol. In the following I try to discuss those two options.
REST is - if you strip it of all it's hype - just passing XML snippets over HTTP. You use the standard HTTP commands, GET, POST, PUT and DELETE. You pass stuff and get stuff. Usually you get XML. Often you put XML, or post forms. Just the same as your browser does, only that the stuff is more formal.
XML-RPC on the other hand is a serialization/deserialization of datastructeres in your programs combined with a REST way of pushing that around (you actually POST the serialized method call and GET the serialized method response). Toolkits integrate this into your programming environment so that you often don't care wether some call is local or remote, it just works (by using some proxy object that handles the serialization/deserialization and POST/GET stuff).
So this actually shows a big difference: REST is just a barebones way to push stuff around. There is no notion on what you push around, it's just XML or form data. Serialization/deserialization is handled by the application itself for every flavor of stuff to push around. Often you just parse the XML into a DOM tree and work with that. To build some result you construct another DOM tree and send that as XML. This works very good if what your applications primary work is pushing around and processing information snippets and documents. It's not very good if your main work is doing interprocess communication or interhost communication in a more programmatic way.
XML-RPC on the other hand maps very good to those programmatic ways, but is a pain if you use it to push around documents. The reason is, you either push the documents around as a serialized string, or you do conversions on the document to translate them into data structures and pass those around. The latter works quite nice if your structures are more or less fixed, but is hairy at best if your structures are bound to change frequently.
So what about blogging APIs? I think they will have to be quite fixed in their structure. Ok, there will be extensions, but the core data (that is stored in databases in many tools) needs to be fixed at least to some extent. So here we are on a border between both areas.
People who like to work with the information and enricht/extract information in a more general way - for example for knowledge engineering stuff - will prefer a more RESTian approach, as that will be much faster. They just need documents as a whole and will most surely use DOM parsers and stuff like XPath to access content.
But there are the oldfashioned application programmers. Those who build simple plain applications to just do one thing nicely: aggregate feeds, present them to users and allow blogging of the stuff. And there are blog software programmers with existing products that would like to enrich their application with a standard API. All those people will prefer a more programmatical approach, as that fits much better into their application. Using DOM trees and traversing full documents won't help them, as they actually will throw away much of the enriched stuff (except where the explicitly support it). This is fine, as they set total different goals for their software, their main focus is the blogging experience, not so much the knowledge engineering.
I think exactly this is a good reason to provide both in Necho. A RESTian API for full document working and XML-RPC API for more programmatic access. Both have their points for them.
I would like to see the REST API be the leading API, the primary API. Why? Because I am quite sure that sooner or later blogging applications will become much more than they are today. So the goal should be to pin down a good way to work with documents and information in a more abstract way, and REST is in my opinion much nicer.
But the XML-RPC API will allow people to implement stuff now and with their current tools. It won't be too much work for them, as they can build on existing stuff in their application. This will give Necho a much broader base in the blogging world, even if some of those people only use part of it's power. That's the reason why XML-RPC should be the minor protocol, somehow deduced from the full REST protocol.
How to do this? I think what is needed is a simple mapping that shows how to translate between a Necho entry and an internal data structure that can be passed by XML-RPC. And some minimal API to post, edit and delete entries in the database using XML-RPC. This will be enough to allow people to make use of Necho now.
The full power of Necho will only be unleashed when you use a more document centric approach of passing stuff around, but that doesn't say that we shouldn't give some gentle pushing to the spec!
|