“Choose AFNetworking for your next project, or migrate over your existing projects—you’ll be happy you did!”
One of the most discussed points in software companies, between their managers and coworkers is about the question “rewrite the program or not rewrite it?”.
Many would argue that starting over is shooting yourself in the foot, because, after all, it would be a declaration that you screwed up and you couldn’t bear the errors from the past rather than understanding where you made mistakes. It would be like giving up, a moral weakness and a strategic bankruptcy. Worse: it’s going to be the same software with more and different bugs!
In Cheesecake Labs we deal a lot with HTTP requests, one of the most complex and unreliable parts of mobile development, and it’s really time-consuming to test every refactoring and commit in each new project. Every now and then, rewriting can’t be avoided at all.
However, would we go through lots of re-coding, if we had something that was widely used and worked wonderfully? What if there were an external library that made fairly complex networking operations possible, being extremely lightweight and easy to use? That is AFNetworking, which covers a great deal of our job. It’s robust, with a good acceptance of the community and it’s an open-source project, which means that everyone can (and does actively) collaborate to create a better framework. HTTP requests can be easily set up with this library, saving a great deal of time and energy, without losing efficiency in the process. It’s safe to say that strange bugs won’t be appearing if you make use of AFNetworking, as there are many people involved in the library’s updates.
We are currently working with AFNetworking in two projects. Although we use it for extremely similar functions, we’ve built slightly different structures: in the first project, we use the library’s code directly, explicitly importing parts (functions) and using them throughout our codebase; in the second one, we create an intermediate layer that provides a more organized and abstract usage of the core AFNetworking functions.
It’s really a miracle: 15,000 lines turning into half a dozen. It won’t look messy, ugly or with a ton of errors — that you’d probably do if you were (re)writing from zero. When you see something like AFNetworking, it is a turning point on networking programming. So, if you are experiencing troubles in that area and yet you never used this library, you are probably wasting your time.