Saturday, March 06, 2010

RPC - How can you be two places at once when you're not anywhere at all?

Recently I've been looking into using either XML-RPC or JSON-RPC to communicate between a Cocoa client and a PHP back-end.

I came across Samuel Sutch's Objective-C implementation of JSON-RPC and saw what to me is a curious pattern: methods with no name that take any object (id) as an argument and return an object of indeterminate type (id)

- (id):(id)arg {
  // do stuff
}

While this is legal in Objective-C it sure is difficult for me to follow. That said, I'm not an expert in ObjC so I consider this a learning opportunity.

I suspect that the reasoning behind this has something to do with the fact that the author is implementing a version of the "Deferred" pattern. Still, it seems like code that is very hard to maintain. I'm hoping to get in touch with the author and learn more. At a minimum I hope to become better educated.

Technorati Tags: , , ,

No comments: