Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

NSURLConnection+BlocksKit too verbose #19

Closed
zwaldowski opened this issue Jul 18, 2011 · 5 comments
Closed

NSURLConnection+BlocksKit too verbose #19

zwaldowski opened this issue Jul 18, 2011 · 5 comments

Comments

@zwaldowski
Copy link
Collaborator

One of my primary goals with BlocksKit is to be slim yet functional; I don't aim to replace all locations in Foundation in UIKit where a delegate comes up. I estimate that a delegate protocol which provides for greater than 10 method implementations is not fit for BlocksKit. Of course, this is directly at odds with our new implementation of NSURLConnection.

I'm thinking of removing shouldUseCredentialStorageHandler, willCacheResponseHandler, willSendRequestRedirectResponseHandler, didRecieveDataHandler, and didSendBodyDataHandler.

Thanks to Igor's design, delegation methods are still available at the same time as block handlers, so any developer that requires these more in-depth use cases should stick to those methods instead. In most cases, using a delegate method would take the same amount of code, and a far more powerful approach would be using an intelligent set of defaults (YES to shouldUseCredentialStorageHandler, return the data for willCacheResponseHandler, let the willSendRequestRedirectResponseHandler go ahead).

I'm going to mention @evsukov89 a few times so he sees this and we can discuss it. @evsukov89 @evsukov89 @evsukov89

@igorski89
Copy link
Contributor

Unfortunately mentioning my username didn't helped — I haven't received any notification from GitHub.

I have a different opinion — I think we should leave those callbacks: a header file not too verbose, but when You are using blocks and need to use delegation for some special case — You would be very disappointed, mostly because all of Your's program workflow will be designed for blocks and not for delegation

P.S.: I know that this comment is irrelevant because You've already removed those callbacks

@zwaldowski
Copy link
Collaborator Author

I'll reconsider it, but I feel like those specific callbacks use enough code in a typical implementation to be "too big" for blocks.

@igorski89
Copy link
Contributor

My point based on that is development based delegates and blocks are very different and if You are using blocks and switching to delegation for just one callback would break a lot of abstractions in Your app.

@bwhiteley
Copy link

"too big" for blocks ... Interesting.

I just converted a project to use NSURLConnection+BlocksKit. I had to use 5 of the delegate methods. Most of my blocks (about 200 of them) are bigger then the largest delegate method.

It worked out fine, though. The delegate methods are common to all of my REST calls, and the blocks handle the logic specific to each call.

Thanks for BlocksKit.

@zwaldowski
Copy link
Collaborator Author

Thanks Bart, I think that sums up my opinions on this issue pretty well. Very much what I've said previously. I'm closing this for now, but I might reopen it pending the result of what's going on in the experimental branch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants