5 ms·
I’ve written a lot of Objective C. It is by far the worst language I’ve used professionally. While I don’t love Swift it is still a breath of fresh air compar
by orasis 3y ago
I’ve written a lot of Objective C.
It is by far the worst language I’ve used professionally.
While I don’t love Swift it is still a breath of fresh air compared to ObjC.
- buzzert 3y agoCare to elaborate? Objective-C's simplicity and minimalism is what makes it one of my favorites.
- pavlov 3y agoI like Objective-C too. It's just C with a very good lightweight abstraction layer for modeling GUI apps. I'm enough of a purist to think Obj-C 2.0 (introduced around 2007 at the same time as iOS) was mostly a mistake. In old Objective-C, it was absolutely clear when you were sending a message. You couldn't mistake a line of C code for an Obj-C message call. But Obj-C 2.0 lets you use the same syntax for message calls and struct member access, as in: foo.view.bounds.size.width Two of these dots are expensive virtual message calls. The other two are practically free stack pointer offsets. It's not in good C spirit to introduce this kind of confusion about performance impact. (However it's very much in the worst C++ spirit of frivolous overrides.) And the benefits were mostly meaningless because the old way (which still works) was barely any longer to type, especially with IDE autocomplete: [[foo view] bounds].size.width
- mpweiher 3y agoYep. And what's even worse is that the semantics are muddled. foo.view.bounds.size.width = 200; This will not set the width of the view to 200.
- another2another 3y ago>But Obj-C 2.0 lets you use the same syntax for message calls and struct member access I'm in 100% agreement, you should never hide the message passing syntax, and am not a fan of this feature. Alas it was probably introduced as a sop to those people that are constantly complaining about the syntax, and in the process made the language worse ergonomically, not better.
- orasis 3y agoThere is nothing simple or minimalist about C style separate header files with hacked on property synthesizers. The language is an aggregation of hacks.
- Apocryphon 3y agoThere can be simple, minimalist aggregation of hacks.
- starbugs 3y agoWhat languages have you used?
- orasis 3y agoC, C++, Java, Kotlin, JavaScript, Python, Ruby, Objective C, Swift
- starbugs 3y agoI'd argue that C++ and Java are way worse than Objective C.
- nesarkvechnep 3y agoAll are the same language.
- zer0zzz 3y agoI suppose you were expecting him to throw smalltalk or clasp or prolog/datalog in there to get your approval? This was rude.
- zer0zzz 3y agoFour of those languages are ones where you can almost always statically tell when code is dead. Two or three of them are dynamic languages with large investments by multiple companies and communities to make the dynamicness less terrible for performance and code size. The one that is neither is objc (ignoring recent awesome improvements like objc_direct).
- flohofwoe 3y agoWhat are your complaints specifically? In the beginning I also hated it (mainly because it was on a platform I didn't care much about). But the more I wrote ObjC (mainly in context of Metal) the more I started to appreciate the "minimal elegance" which is the complete opposite of C++ - I don't appreciate the fact that every object access is a dynamic method call though ;) (but that's where C comes in) Typically I wrap the ObjC code which needs to call into system framework in subsystems which then expose a simplified C API (same with C++ libraries, wrap the C++ shim under a simplified C API), so that most platform- and library-agnostic code is written in plain C. ObjC never got in the way though, and the nice thing is that (unlike C++) it supports the latest C features.
- pjmlp 3y agoOn my case, plenty of @ [] to type. C++ already supports more C than it should.
- flohofwoe 3y agoObjC 2.0 introduced dot-syntax for property access, gets rid of most of the [] (but still is a two-edged sword, because it looks like a cheap operation, but is a method call under the hood). The '@' might look ugly but it's a good way to separate ObjC keywords from C and C++ keywords, so that ObjC can introduce new keywords without risking to break existing code. (but this like complaing that Python uses tabs for scope blocks, or that C and C++ have too many {}, it's just a matter of getting used to it)
- pjmlp 3y agoDot syntax does nothing for regular messages. Forgetting how hard they are to type in some keyboards, depending on locale? Not everyone is using US layouts.
- flohofwoe 3y ago> Forgetting how hard they are to type in some keyboards, depending on locale? { } is just as bad on German keyboard layout ({} is right-Alt 7/0 and [] is right-Alt 8/9 - on Windows at least, don't even remember on the Mac). That's basically why I switched to English keyboard layout right after I left the Amiga (which actually had a decent German layout for programmers). > Dot syntax does nothing for regular messages. True, but at least in the Cocoa and Metal code I usually write, there's a lot more property accesses than traditional method calls.
- waffletower 3y agoI have written a lot of Objective C. I don't use it much anymore, except to maintain some existing applications. That said, I still believe my time with it was much more ergonomic for my applications than Swift -- particularly its ability to act as a system language -- given it is a strict superset of C. Further, with the introduction of Swift I chose to change career direction, perhaps somewhat literally because of my dislike of the new language. I chose to go deeper into dynamic languages and now use Clojure, and to a much lesser extent, Python, professionally.