On Aug 7, 2010, at 12:04 PM, Kyle Sluder wrote:

> On Aug 7, 2010, at 9:42 AM, Dave DeLong <davedel...@me.com> wrote:
> 
>> Let's say that I have an object that encapsulates a Google search.  I feed 
>> this object my query string, set some options, and then execute it.  
>> Ideally, I'd like to get back an NSArray of all the results, but 1) that 
>> isn't practical and 2) the Google API doesn't support that.
>> 
>> So what if I use an NSProxy?  Can I return an NSProxy in place of the array 
>> that knows how many total results there are, and then as the user asks for 
>> more and more results, it just silently executes "paged" searches to get the 
>> next batch?
> 
> This sounds like a bad idea. It might work, but it will introduce 
> hard-to-follow network access. What if someone asks the array for 
> -lastObject? Or -reverseObjectEnumerator?
> 
> Since I guarantee at some point clients of your searching logic are going to 
> need to be aware of the nature of Google API searching (in other words, your 
> abstraction will leak), it would be best to expose on your Google-searching 
> controller object specific API for paging through results. It might be as 
> simple as a -loadMore method and a resultsSoFar NSArray property.

Agreed, but also:

Even for the original vision, you don't want a proxy object.  You would have 
just wanted a custom array class.  What would the proxy have been a proxy for?

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to