Wednesday, February 15, 2017 [Tweets] [Favorites]

Swift and Objective-C Forever?

Jeff Johnson (Hacker News):

When Swift became public in 2014, its creator Chris Lattner seemed to claim that Swift and Objective-C would coexist indefinitely.

[…]

The problem is that nobody believes this. And of course Lattner has now left Apple, so he won’t be there to take the criticism is his claim turns out to be false. The consensus among developers is that Apple will eventually deprecate Objective-C, and Swift will become the sole first class language for Cocoa app development.

[…]

You only have to review the history of Apple developer relations to see the long string of deprecations, disappointments, suffering, and broken promises. Objective-C garbage collection, 64-bit Carbon, the Cocoa-Java bridge, Yellow Box for Windows, Dylan. Need I go on? I could go on. Apple evangelists will tell you that Swift is the best programming language ever and then turn around and tell you that we’ve always been at war with Swift.

[…]

The people who think Apple will deprecate Objective-C, how do they think Apple can handle it? Some people suggest that Apple will deprecate Objective-C externally, but they will continue Objective-C development internally and indefinitely. However, I think these people underestimate the problem. Given the amount of Objective-C code Apple has, and the constraints they’re working under, taking the slow road internally to a Swift future would be a very slow road indeed.

I don’t see Apple dropping Swift. The technology seems to be sound, and Apple has really put its reputation on the line in a way that it didn’t with the other canceled projects. Plus, unlike those, Swift already has massive adoption outside of Apple.

That said, I expect that Objective-C, while not being deprecated, will decline in popularity the same way that Carbon—also officially a first-class coexister—did. I don’t think that Apple will maintain sample code parity for much longer.

Johnson is right that there are many open questions about how Apple will manage this transition—if that’s what it is—both internally and externally. It will affect the OS itself, Apple’s apps, the public APIs, and Apple’s own staffing. It’s got to be difficult for Apple to hire and retain WebObjects programers for its internal services, and it could face similar issues, to a lesser extent, if developers continue to switch to Swift.

4 Comments

"I don’t think that Apple will maintain sample code parity for much longer."

Well, at least, Objective-C sample code does not break every six months. I hate it when you are providing with sample code and you have to fix it just to make it build.

Here's what I think Apple should do with Objective-C: keep it in maintenance mode only, keep it working with its Cocoa API, make sure what is there does not break, enhance it only to the minimum degree needed to keep it viable on the platform. I maintain a large project that depends heavily on Objective-C and Cocoa, and it makes zero sense to rewrite this project (mostly C-based) in Swift. This is what Apple should have, and could have, done with Carbon. (It was running in 64-bit up until they decided to pull the plug on that, simply as a business decision.) I do not accept that Apple lacks the resources/manpower to maintain legacy API's in this fashion. I think the likelihood of this is greater than with Carbon simply because so much of macOS and iOS is written in Objective-C, much greater than with Carbon.

@someone I was actually thinking the opposite. Much of the C/Objective-C sample code I’ve downloaded doesn’t compile because of deprecated APIs.

@Kevin Yes, and Apple has a lot more of its own stuff in Objective-C than it did in Carbon.

Apple shouldn’t keep code parity.

Just give Swift a clean death. Or at least try not to force it into a ‘production’ or ‘non-educational’ environment.

It’s clearly a beginner’s language with serious shortcomings that have been attempted to overcome with ugly, non best-engineering-practices hacks.

Sometimes, you actually need to understand memory to develop - trying to cover up that fact, does a disservice to the community as a whole.

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment