4 ms·
Fine, I'll bite. Assuming you're belittling Objective-C, let's not forget that Objective-C is simply C with Smalltalk bolted on. I'm having a hard time imagini
by jspthrowaway2 14y ago
Fine, I'll bite.
Assuming you're belittling Objective-C, let's not forget that Objective-C is simply C with Smalltalk bolted on. I'm having a hard time imagining a plane of reality in which either is not "half decent". Objective-C is, in my opinion, much better than C++ to accomplish the same task (they have semi-equivalent aims, though implemented very, very differently).
I learned Objective-C and iOS (then called iPhone OS) from scratch to write a quite-complex app once. The app has been in the store for two years now. Like you, initially, I balked at the brackets; everybody does. Eventually, I was actually pleased that my C experience carried over so well, and it was a pleasant experience in the end. As you do, I wrote two to throw away until I mastered the platform, and I didn't mind it at all.
Assuming your object user has an update method which takes a name argument and you want to store the result of calling update somewhere, here's Python vs. Objective-C (the Smalltalk-influenced terminology is different, but the concepts are the same):
save_result(user.update(name="Larry"))
saveResult([user updateWithName:"Larry"]);
I don't find one much more horrible than the other.
- krichman 14y agoObjective C is brilliant, it's one of the few things I actually enjoy about Apple's ecosystem. This is because it stole ideas from Smalltalk, which is also brilliant. I doubt there are many people who hate it rationally, but I'd love to have a discussion with them instead of the people that have some knee-jerk reaction to the message-passing syntax.
- andybak 14y agoI dislike it because the code samples I see look really ugly and hard to follow. Now maybe that melts away when you learn the language but I've heard enough complaints from people who have to get the feeling that's not entirely the case. Readability is probably the most important language feature.
- eropple 14y agoIt's not just the brackets, though they're ugly and provide stops for the eyes where none should be; you have NSReallyReallyLongNames all over the place (encouraged by XCode, to the point of automatically doing it for your own classes, because namespaces are apparently too modern), required parameter names, and other silliness that makes Java look restrained. And while we're at it, its interop with an actual, fairly standardized modern (note: this means "not C") language that people use (so C++, for those keeping track at home) is not very good, and while you might find Objective-C superior nobody else uses it so C++ is probably going to be involved somewhere, be it Windows or Android. Objective-C is tolerable, sure, but I'd rather write C++ - and that is no compliment to C++. (But, as a side note, I give Apple all the credit in the world for having a fantastic C++ environment on its own. XCode has its stupid spots, but it doesn't get in clang's way.)
- jspthrowaway2 14y agoI actually vastly prefer a language without namespaces, and the naming conventions are not due to the absence of namespaces. You're talking about the NextStep API (the "NS") and the conventions that were born from that -- there is no mandate nor impetus (and, I don't recall Xcode automatically doing it for me) that you use that convention yourself. They just carried it through for the other APIs, like UIKit being "UI" (UIViewController, etc). My User object was called, unsurprisingly, "User". [[User alloc] init]. As for interop with C++, Objective-C++ exists and is used for apps in the store. (Hint: 3D games that are ports.)
- eropple 14y agoXCode has a setting in a new project to prepend to all class names. The necessity of that sort of feature indicates a failure of linguistic design (by which I mean the necessity of clearing up symbol pollution--there is also an argument for their use for explicitness, which I reject because the world has shown us its obvious failure). Even just aesthetically--vomiting out half-line identifiers every time I have to refer to a class is, for me, painful and stupid and makes me hate reading what I've written. One of the worst feelings in the world is looking at code you've written and hating even looking at it, and for me there are only three languages I've spent time with where that's the case for reasons beyond me fucking up: Java, Scala--for reasons entirely unrelated to its Java heritage, it makes its own mistakes--and Objective-C. As for Objective-C++, it's useful in a limited capacity but often requires unscrewing your object model in pretty stupid ways just to provide inputs that the Objective-C side won't barf on. It's an "ehh" hack with painful edge cases.
- jspthrowaway2 14y agoI shouldn't have bitten. This is like arguing over why a Phillips screwdriver is better than a flathead with someone who particularly and angrily hates Phillips screwdrivers because he doesn't like their appearance. They're tools, bud. I'm pulling my rip cord on this discussion based on your tone, the nearly guaranteed futility, and the complete lack of any realizable benefit in my own life of carrying on. Good evening.
- Turing_Machine 14y ago"I'm having a hard time imagining a plane of reality in which either is not "half decent"" Garlic is good. Ice cream is good. That doesn't mean that garlic ice cream is necessarily good. It exists as a promotional gimmick, sure enough, but it won't be in Baskin Robbins any time soon.
- plinkplonk 14y ago"let's not forget that Objective-C is simply C with Smalltalk bolted on. I'm having a hard time imagining a plane of reality in which either is not "half decent"." One can always mix first rate components badly to create abominations. Not saying Objective C is an abomination, but pointing to the coherence of the underlying languages is not much of a defence of the clarity of Objective C.
- deleted 14y ago[deleted]