Refactoring
I just came back to Taipei and will spend the next two days in Chutung, attending HappyDesigner’s second gathering and catching up with friends.
For the last two days I have been refactoring the framework. One thing that I have to say is that, since ObjectiveFlickr is still in a very rough and early state, each new version mak break somewhat what was available before…
I’m thinking about removing OFFlickrRESTRequest altogether, creating an OFFlickrHTTPRequest instead. In fact it’d be nice to have a HTTP transport class, because we may also want to fetch the image–you don’t want to do that with NSImage’s initWithContentsOfURL, it’s blocking your code!
We will actually need two HTTP transport classes, one for regular GET/POST requests with a potential large return data, and another for doing large POST request (i.e. “uploading”). This is because NSURLConnection is not good at doing large POSTs… well, at this point I was actually thinking, if we should scrap NSURLConnection altogether and simply use CFReadStream for everything?
There are other design considerations, such as simplifying the error codes, and making classes Key-Value-Coding compliant. In addition, there is actually a very nifty way of getting Flickr XML data that is converted into NSDictionary (using flickrDictionaryFromDocument method), which is called “value path” and is a part of the KVC convention. I haven’t tried out that yet.
In the end, all those async things smell like reinventing the wheel of XMLHttpRequest… why didn’t we simply create a WebKit object and make Javascript work for us? Or maybe some AOCX (OC for Objective-C) may eventually surface. Who knows…
Lots of work ahead, will keep you posted on the progress. Before then, if you’re already using ObjectiveFlickr, I’m eager to learn to which extent are you using. Some things will really break in the next few revisions…
lukhnos :: Oct.01.2006 :: tekhnologia :: No Comments »