Thursday, February 6, 2020

Objective-C Quiz

Robert Widmann:

Objective-C is a simpler language than Swift.

The Ontology around Objective-C is a minefield of complexity far outweighing anything Swift could hope to approach.

Before you argue with me, take a short quiz.

David Smith:

I believe I can probably generate a longer list of hard to answer questions in Swift using only the behavior of the “as?” operator, so I’m not sure I agree with your premise.

Regardless, it’s an interesting quiz, though I have quibbles with some of the wording.

6 Comments RSS · Twitter

Here in the real world, I’ve seen so much more overly complex swift code than I’ve ever seen Objective-c code. Swift might be a more “pure” language for type theorists, but it has so many pitfalls and invites one to write complex code.

Objective-C reminds me of Apple from 2001-2011: it’s not perfecf, but it’s usable and tries to solve real world problems in understandable ways. Objc is like iOS 6: not fancy, but polished.

Swift on the other hand reminds of the modern Apple: everything is in a constant state of being broken in multiple ways and stuff is overly complex. Swift is like iOS 7.

Objective-C is a 2010 Mac Pro. Swift is a 2020 Mac Pro.

I've written a gazillion lines of Objective-C++ over the last several decades, and I looked through the quiz and many of them I would answer with “no idea, I would never do that”.

People can write crap code in any language.

I haven't had to write any code in Swift. I've heard mixed reports, some people love it, some people hate it. Personally to me it looks like line noise, less readable than Perl, but I'm sure that will change when I eventually find a need to learn it.

I saw the quiz, and thought it posed interesting questions, many of which I didn't have an immediate answer for. However, those that I couldn't answer are also things that never caused any issues for me in 20+ years of programming in Objective-C.

I agree fully that Objective-C is much, much simpler than Swift, but not that its ontology is necessarily more complex or worse than Swift's. I do believe that knowledge of its weird corners, like the things mentioned in this quiz, are more spread out and harder to find knowledge about, but again, that arcane knowledge is not generally useful for building software in Objective-C.

I really hope Apple would revert back to using Objective-C. Swift is just sugar coated C++. Extremely complex and bloated with no clear roadmap of solving of any its quirks.

> The Ontology around Objective-C is a minefield of complexity far outweighing anything Swift could hope to approach.

Despite this, I tend quickly understand most random Obj-C projects I look at. Meanwhile, when I look at a random Swift project I'm slower at reading and understanding (and building), and tend to find solutions that are "clever" (not a compliment). I get tripped up by odd specific cases or interop, or new/changed features, or one-off shorthands, or the author went crazy with generics, or everything as a protocol, and now I need to look something up…

I do not often find Swift to be "clearer" than Obj-C, just less "wordy". The philosophy and approach of Swift is generally opposite of how I think or what I want in an APPLICATION language. I'd be more productive if the effort Apple put into Swift was instead applied to fixing bugs in their frameworks, fixing sandboxing (and the security model), and adding a few nice things Swift has to Obj-C.

I love Obj-C and AppKit/UIKit (as flawed as they are), but my mind rejects Apple's C+++ (just as it rejected C++ for Obj-C and Cocoa 20 years ago).

Leave a Comment