upbeat.it

by Cesare Rocchi

I wrote an application in Objective-c

by Cesare Rocchi

Tags: podrover

Podrover Diaries is about my adventures in building Podrover, a service to track, collect and share your podcast reviews. Subscribe to the RSS feed or join my newsletter to stay up to date with upcoming adventures.

No, I didn’t inherit an old project. Yes, I know it’s 2017. Yes, I know there’s a thing called Swift. And yet, on January 2nd I created a new Xcode project, I picked Objective-c and I don’t regret it. In around ten days I built Podrover and it was smooth sailing.

Backstory

I began using Swift a few hours after it was announced. I jumped on the bandwagon. The carriage was pretty crowded and I remember many people smiling. I used Swift to write books and to build apps. As time went by my enthusiasm slowly faded away, leaving room to one of my arch enemies: friction. At times, building apps with Swift felt like cutting wood with a rusty saw. If you insist you get to the end of the tree, but it takes longer and at the end of the day you are more tired.

Last year, when I was building Quoteplay, I clearly noticed that I was more stressed after a day of coding. But most of all, I wasn’t having fun. After finishing Quoteplay I took on a client project. It was an MVP, with the clear possibility to write throwaway code. I decided to give Swift another chance. As I heard about the upcoming changes to Swift 3, I rushed through the schedule and delivered the app 3 weeks in advance, because I was scared shitless of the migration. Side effect: the client was extremely happy :)

Back to the future

After those adventures it was clear that Swift wasn’t the ideal tool for building my products. Running a self-funded business encompasses many activities and there’s little time to babysit a code base.

I took a look at React Native and I was interested in the transition that Artsy made but in the end I decided to play it safe, and go with Objective-c. Here’s why.

  • Knowledge: I have been using it for almost ten years. I feel comfortable working with it.
  • Speed: Compared to a Swift project, an Objective-c only project is damn fast in compiling. I didn’t measure it, but it’s clearly perceivable.
  • Calm horizon: with all the attention devoted to Swift, it’s very likely that Objective-c is not going to suffer breaking changes in the future. I like boring and battle tested tools.
  • Malleability: Swift feels a bit like clay that hardens too quickly. I prefer clay that stays soft for a bit longer.
  • Similarity with Ruby: the backend of Podrover is built with Ruby. Switching from Ruby to Objective-c is much easier for me than switching from Ruby to Swift, in spite of syntactical similarities.
  • Legacy code: right after Swift was announced it was easy to think that “objective-c is now legacy code”. Open a Swift project that you finished eight months ago and let me know. I want to open the Podrover app in a year and be able to work on it right away, and not fixing the syntax of code that used to work.
  • Migration stories: I read many stories about the migration to Swift 3:
  • Finding code: in spite of its youth it’s easy to find code samples in Swift. It’s as easy to find Swift code that does not compile anymore.

I am aware that in the future Objective-c will not be supported anymore (or not?). I wish Apple could be more upfront about this and provide a deadline but they are probably busy dealing with the unexpected success of Swift. I don’t blame them. I’d do the same.

Yet, I feel Objective-c is the safest bet for me at the moment. Plus, it feels retro. And I like retro.

Objective-c is like that leather jacket that you bought in Brooklyn in 1984. There are a few cracks, but when you wear it you feel damn good.