Archive for June 10, 2018

Sunday, June 10, 2018

On My Misalignment With Apple’s Love Affair With Swift

Dominik Wagner (tweet, Hacker News, Reddit):

On top of all of this, there is that great tension with the existing Apple framework ecosystem. While Apple did a great job on exposing Cocoa/Foundation as graspable into Swift as they could, there is still great tension in the way Swift wants to see the world, and the design paradigms that created the existing frameworks. That tension is not resolved yet, and since it is a design conflict, essentially can’t be resolved. Just mitigated.

[…]

If you work in that world you are constantly torn between doing things the Swift/standard-library way, or the Cocoa way and bridging in-between. To make matters worse there are a lot of concepts that don’t even have a good equivalent. This, for me at least, generates an almost unbearable mental load. It leads to writers block and/or running around in cognitive circles trying to answer questions on how to best express the problem, or make Swift be happy with my code.

[…]

Yes, Swift code might end up being more correct in the end. It also might alert you to edge cases early on. However, the flip side is it inhibits your creativity while writing.

[…]

In my opinion, a lot of the “lofty goals” haven’t been achieved, and as discussed, should even be non-goals. Just imagine a world where Objective‑C would have gotten the same amount of drive and attention Swift got from Apple? It is not a big leap to see that everyone would be better off right now. Swift just ended up being a jack of all trades, master of none.

I agree with most of what he says, except that overall I do like programming in Swift, and I prefer it to Objective-C most of the time. I suspect I would also like an enhanced Objective-C much more than the Objective-C that we actually have. I remain unconvinced that Swift was the right strategy for Apple to take vs. putting the same amount of effort into improving Objective-C. But that decision was made long ago. I do not, as he suggests, want to see a pivot back to try that path now. I think Swift (and the frameworks and tools) can get to where they need to go, but a long way remains, and it will require continued sustained focus to get there.

Update (2018-06-10): See also these Twitter threads from: Daniel Pasco, Dominik Wagner, Nick Lockwood, Marcel Weiher, Ilja A. Iwas.

Update (2018-06-11): See also: Steven Sinofsky, Alexis Gallagher, Dominik Wagner, Lukas Spieß, Colin Wheeler, Kyle Bashour, Gopal Sharma, Daniel Pasco, Marco Scheurer, Helge Heß, Kristof.

Update (2018-06-12): See also: Stan Chang Khin Boon, Jonathan Gerlach, Marcin Krzyzanowski, Joe Groff, Steven Sinofsky (tweet).

Update (2018-06-21): Stefan Lesser:

I wanted to write a thoughtful article in response to Dominik Wagner’s “On my misalignment with Apple’s love affair with Swift”. During my research I realized, that Chris Lattner had already done this. Sort of. 17 months before Dominik published his piece.

Dominik Wagner:

Hehe, going full circle. Part of the motivation for my writing down my critique was based on this interview. A lot of the arguments boil down to deferring to the future, are all over the place, or (e.g. fast) not really true.

Colin Cornaby:

Lattner’s responses here are fairly level headed. But the goals mentioned in here, from the Swift manifesto, haven’t necessarily been achieved yet. That’s why they’re stated as goals.

Doesn’t mean Swift will never achieve them, but it’s still a give and take vs Obj-C.

Max Seelemann:

It’s also definitely good to have both sides of the [Swift] story told.

I’m still very much torn in-between though. I’m confident that at no point in the past, switching to Swift would have had net benefits to date. (100% ObjC here.)

But I’m also clear that this day will come…

Also… not a single one of the “core problems” of Objective-C stated in Chris’ post seriously affects us. It’s definitely not memory safety that keeps us up at night.

Devil’s advocate could say, Swift is fundamentally solving problems people (we) aren’t having.

Which brings it down to (for us): Everything Swift offers is a long list of very desirable nice-to-haves.

And in that point I’m totally siding with @monkeydom – there are no essential, fundamental issues being solved. (Again: for us)

Nobody asked, but here I go anyway:

If I had to put my finger on the #1 pain point for us in recent years (!), it’s never been the language.

It’d be frameworks lacking behind in quality. (bugs, workarounds) And UI programming paradigms not evolving with time. (e.g. reactive)

My sincere hope is though, that Swift lays the foundations for that to be tackled one day.

And that once we’re there, it will have fundamental effects on how we do apps.

And so I’m still torn in-between.

Dominik Wagner:

I think the (hidden) cost of complexity is undersold. And Swift opened that bottle wide up by making all the regular things very complex. And as of now it doesn’t even have the big benefits, e.g. like rust’s concurrency safety or full C++ style speed.

Update (2018-08-13): See also: Hacker News.