When to Avoid Libraries

There's a lot of sage advice in this post by Ben Sandofsky:

At scale, life is easier when you rely on as few third-party libraries as you can get away with. Fortunately, you don’t need that many. Out of the box, you’ve got frameworks for animation, networking, persistence, and everything else you need for most apps.

Speaking of networking, I used NSURLSession for the first time recently and was really pleased with how smooth the implementation went. It was way better than the old NSURLConnection delegate approach that I remembered from back before I started using AFNetworking in all my projects.

But on the flip side:

Apple makes mistakes, like the iOS Keychain, or the overly complicated Address Book API. The former justifies a wrapper, and the latter was fixed in Apple’s new Contacts.framework.

One of the few libraries that I'm using in my current project at work is a Keychain wrapper. I wrote the C code for hitting the Address Book and it sucked. But I knew I'd be replacing it with the new Contacts.framework stuff soon enough.

And finally, I couldn't agree more with this bit:

Setting up the Core Data stack takes a bizarre 20 line incantation just short of animal sacrifice. You could use a Core Data wrapper’s one-line setup, but I just copy and paste the boilerplate. That’s right, I copy and paste.

In your first year coding you learn “Don’t Repeat Yourself.” After you waste hundreds of hours debugging excessively DRY code, you realize there’s a difference between repeating yourself and being explicit.