Friday, October 6, 2017

Why Many Developers Still Prefer Objective-C to Swift

Paul Hudson:

Objective-C – once the rising star of the app development world – has started to become a second-class citizen in the Apple ecosystem. Yes, it might occasionally get dusted off for a slide or two at WWDC, but the majority of conference talks worldwide are in Swift, Apple is pushing Swift hard in the education space, and major language features come to Swift first.

But if you’re still using Objective-C, you’re not alone – many other developers still prefer Objective-C to Swift, and with good reasons. I got in touch with some Objective-C developers to ask what’s holding them back, whether they feel Objective-C development has become stigmatized, and more – here’s what they had to say…

[…]

Steve Troughton-Smith: Swift was absolutely catastrophic for Objective-C development; for any new APIs or features I no longer have sample code, WWDC slides, tutorials, GitHub or StackOverflow. Whatever about StackOverflow millennial jokes, but losing access to all of this context and knowledge is devastating. On the plus side, the ObjC language itself has gained a bunch of quality of life/syntactic sugar features to help it interop with Swift better, and all of those have been fantastic.

[…]

Michael Lauer: I can only dream about what could have been Objective-C if there was the same manpower behind it.

[…]

Marcel Weiher: Objective-C is OK for what it is and really needs a bullet in the head more than further development!

What’s more surprising and somewhat disturbing is how many obvious defects in the libraries and “preferred coding styles” that would have been trivial to fix without introducing a whole new language weren’t until Swift arrived – and are now attributed to Swift. It’s almost as if these improvements were held back in order to make Swift look good, though I am pretty sure that’s not how it happened.

However, the biggest negative impact will be that it will most likely prevent the development of successor that’s an actual improvement. We really have enough information to build such a beast now, and Apple ignored just about all of it.

It’s not good that people feel left out, but I’ve been pretty happy with the advancement of Swift so far. I feared that people wouldn’t embrace it, and it would be stuck in a limbo like some other former Apple technologies. People would be worried about using it because they thought Apple would drop it, and this would become a self-fulfilling prophecy. Instead, it seems like the train is going full steam ahead, and that gives us clarity. You don’t have to give up Objective-C right now if you prefer it. But time spent learning about Swift at this point will not be wasted. Swift is the future for most development. Yet I think Objective-C will remain useful for a long time to come, both because of existing code bases and because certain APIs and optimizations are more accessible from it.

Update (2017-10-06): See also: Steve Troughton-Smith, Wil Shipley, Hacker News.

9 Comments RSS · Twitter


I'll say it: I despise Swift.

And I don't think it makes sense to use it for any projects until AppKit and UIKit go away and get replaced by something similar to React or Vue. To me, it seems like Swift is grafted on to these frameworks that were built for Objective-C, and what we get are a lot of oddities and funkiness that shouldn't exist. I think this funkiness and oddities manifest (worse) on the Mac than it is on iOS, but I primarily care most about the Mac.

Admittedly, the language has had a net-positive effect on the entire Apple developer domain, but there's just something stinky and arrogant about it that pushes me away.

It's like... why bother with Swift when there's ECMAScript 6? Why are we even doing Swift...?


"I feared that people wouldn’t embrace it, and it would be stuck in a limbo like some other former Apple technologies."

Considering Apple's marketing total commitment for Swift, there's nothing to fear here.

Xcode 1.0 was totally unusable compared to Project Builder. Yet, Apple put all its marketing money behind it with B.S. testimonies that version 1.0 was an awesome product (on the developer.apple.com website). And, finally, around Xcode 2.5 (3.0 for some, 4.1 for others), Xcode became a nice solution.

The same is happening with Swift. 1.0 was a marketing B.S. regarding the performance, the easiness to learn the language, the toolchain, etc. Swift, as a language, has improved a lot. All the marketing bullshits gave it more time to mature. But there are still a huge amount of work to make it a nice solution when dealing with the App and System Frameworks. Why such a joy at getting rid of brackets when you.endUpPuttingParenthesis(intheMiddleOf:aSentence)?

Swift is a nice language for contractors (since most of the time, they don't deal with code maintenance). Not sure it's a good language for developers yet. I'm totally with Steve Troughton-Smith when he writes: "Knowing that Swift is the one true 'future' for Apple development has done a lot to push me away from wanting to make apps outright; […] the Swift transition certainly made me feel like this isn't a platform I want to develop for anymore.". And Apple's not fixing bugs but adding hundred of ones with each release is not helping.

But based on experience, it's not impossible that I will become an Objective-C traitor like Wil Shipley. It happened before for me when I moved from Pascal to C.


@someone Nothing to fear now; I was referring to after the initial announcement. I actually really like that syntax. Braces were OK but awkward with multiple adjacent left brackets for nested calls. The biggest problem for me with Swift is that indexing and completion in Xcode break down every single day. That was understandable with 1.0, much less so at 4.0.


I like Swift. I think it's a great language. The only thing I really miss about obj-c is dynamic dispatch of methods. I know you should be able to build something like that with Swift, but that's not the same as the whole language running on a late binding runtime.


All people thinking that it would have been easy to update Obj-C to match Swift features don't know how hard it is to add anything in Obj-C without impacting C/C++ compatibility.

And if Obj-C had to drop C/C++ compatibility, it would have been ridiculous to keep it instead of starting with a clean slate.


> The biggest problem for me with Swift is that indexing and completion in Xcode break down every single day

++


@Ben You aren’t alone. I despise Swift too. It’s so hard to read (especially compared to Objective-C), and I just hate the syntax. Backward variable declarations, var/let/func, and weird punctuation usage drive me batty.

I’ll be used Objective-C as long as possible on the Mac, and elsewhere.


@Jean-Daniel I haven’t seen anyone talking about Objective-C matching Swift’s features. Just that there was low hanging fruit that seemingly could have been added (or added sooner).


Swift is a decent C++. For what that's worth. And a bag of arse as a Cocoa development language.

Leave a Comment