8 ms·
C++ Versus Objective-C
- bdfh42 15y agoIf this is a contest - then I declare "No Contest". C++ is a standards based language available across multiple platforms and the other one isn't.
- Turing_Machine 15y agoObjective C is available anywhere GCC is available (i.e., essentially everywhere).
- drewcrawford 15y agoHow I wish this were true. For example, lack of Objective-C and Foundation in NaCl is my primary barrier to using it. https://developers.google.com/native-client/faq#ProgrammingLanguageSupport https://developers.google.com/native-client/faq#ProgrammingL...
- wtallis 15y agoIs there any actual incompatibility that prevents building an Objective-C runtime for NaCl, or is it simply a matter of ObjC not being included by default?
- drewcrawford 15y agoI've been thinking (warning: pure speculation ahead) that I could target my binaries to LLVM IR and then use the highly-experimental PNaCL. But who knows how long it will be before that is viable.
- xorglorb 15y agoThis is pure speculation, but its possible that the runtime does some tricks for performance (possibly in the method dispatch routine) that the NaCl sandbox doesn't allow.
- runn1ng 15y agoFoundation is a diferent beast than Obj-C. Obj-C is an open standard language. Foundation is a proprietary library with some key stuff even PATENTED by Apple (for example, the AutoRelease Pool falls into some of the Apple patents).
- alexbell 15y agoFor most people, what makes Objective C so useful though is the Cocoa core classes. The GNUstep stuff has a lot of that functionality, but is not quite what the Apple stuff provides.
- shin_lao 15y agoThe article is from 1997...
- protomyth 15y agoSo, I guess python, perl, and ruby would lose a contest to COBOL which has a ANSI / ISO standard[1] and is available across multiple platforms? I think implementation based standards have a place. [1] http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+1989-2002 http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%...
- masklinn 15y ago> C++ is a standards based language Technically untrue, C++ is a standardized language, the standard was created after the language. Ada is a standards-based language. So's haskell. The first C++ implementation (as well as "The C++ Programming Language") were released in 1985, while the first C++ "standard" was released in 1998 (ISO/IEC 14882:1998). > available across multiple platforms and the other one isn't. Objective-C is available on pretty much any platform on which GCC or Clang runs, actually.
- cplusoop 15y agoThe lack of destructors and constructors makes Objective C miss an entire galaxy of functionality. That the language authors and programmers don't sorely miss this feature is a testimony to the limited understanding they have of programming. Lack of destruct-when-I-leave-scope makes real exception semantics impossible, and no "smart" objects that clean up after themselves meaning it's impossible to create abstract data types with such limited features. Programmers who don't miss these features I call "flat programmers" because they are missing an entire dimension in their code. They are forever having to understand the details of their implementations instead of being able to package up functionality from initialization to destruction in abstract terms. Don't bother trying to explain any of this to them. People don't understand what they don't understand. They don't even know what they are missing. But I suppose this is appropriate for Apple programmers who are more concerned about which pixels appear in a drop down list box than the overall job their program is attempting to do.
- SeanLuke 15y agoYour diatribe would have been slightly less absurd had you realized that this article described what Objective-C was like fifteen years ago: indeed the article predates OS X. Things have changed.
- wtallis 15y agoI'm not an expert on Objective-C, but I think this article was bad and dated even in 1997. It doesn't mention reference counting, uses -free instead of -dealloc, and seems to consider ANSI C as relatively new and optional, which means the author was either years out of date, or was arbitrarily ignoring some language features that he considered to be part of the NextStep system instead of the core Objective-C language.
- blago 15y agoThis is like saying that C++ developers are shallow because the language doesn't have closures.
- 15y ago
- deleted 15y ago[deleted]
- Apocryphon 15y agoThis is an interesting (though incredibly dated study) from an academic standpoint because both languages are supersets of C and represent two different lineages (Simula vs. Smalltalk). That said a more modern and useful study might be a set of comparisons between Objective-C and Java, since they are the current mobile dev languages of choice.
- mahyarm 15y agoCross Platform C++ code integrates with Objective-C, so it's still useful.
- masklinn 15y ago> This is an interesting (though incredibly dated study) from an academic standpoint because both languages are supersets of C Technically, C++ is not a superset of C. And each new release of either language has them get more incompatible with one another.
- wsc981 15y agoI've never really programmed in C++, but I have to say (as an iOS developer who's programmed in Java, Basic, C# in the past) I love Objective-C. It's really easy to write good, object-oriënted code in the language and it got so much better with the release of iOS 5 and the new SDK, especially because of ARC. I'm not sure if C++ has anything comparable to ARC.
- killedbydeath 15y agoC++ had implicit reference counting for many years now (more than a decade for sure).
- albertzeyer 15y agoI wasn't sure what ARC is: It means Automatic Reference Counting. http://clang.llvm.org/docs/AutomaticReferenceCounting.html http://clang.llvm.org/docs/AutomaticReferenceCounting.html In C++, you have std::shared_ptr (or boost::shared_ptr and many others) which do automatic reference counting (although you specify it explicitly that these pointers have automatic reference counting; there is no way to simply enable it for all raw pointer types).
- runn1ng 15y agoThe thing that this 1997 is missing is the retain - release mechanism, found "only" in classes, that are derived from in NSObject, and still a key Obj-C feature. I don't really know when exactly was this added to NeXT/Cocoa API, but I think it's important to note.
- forrestthewoods 15y agoI hate Obj-C with a fiery passion. My single biggest issue with it is that it simply does not make my life as a programmer any easier. On the other hand when I work in C# I am constantly amazed at how damned easy the language and the libraries make my life. Not once when using Obj-C have I ever said, "Wow, that was so easy thanks to Obj-C!!!" I am more likely to curse the heavens as to why the debugger can't show me the contents of any basic container type. Going forward my work will be as heavily cross-platform C++ as I can make it. The UI may be done through platform native interface constructs, but everything I can possibly make C++ I will.
- alexbell 15y agoWhat you care to provide an example? Are you referring to not being able to mouse over a var during debugging and having it displayed properly? I've never minded having to use gdb to type out "po items", but can understand that if you're used to mousing over and getting vars it would be annoying. I don't disregard your perspective, mine is just exactly the opposite (I would prefer ObjC/Cocoa to C++/<Framework of your choice>, no contest).
- forrestthewoods 15y agoMy perspective is one of a PC/console game background who works on iOS stuff on the side. The transition from VisualStudio/C++ to Xcode/Obj-C is eye stabbingly awful. Obj-C can absolutely accomplish most anything that C++ can, but I don't think the language makes of it easier. Once you've learned that GDB even exists and figured out many of the strange syntax nuances it's passable, but in my opinion not easier. By comparison going from C++ to C#, Lua, or Python (my personal experiences) is astonishingly easy. Not just easy at first but continuously surprising at how many wonderful things you can do and how easy it is. As I said in my root post not once have I ever said "holy shit Obj-C sure made this task easy!"
- alexbell 15y agoFair enough, and I can certainly empathize with wanting to use C++ so you don't have to rewrite everything for another platform. My perspective is going from the C/C++ (on Visual Studio for the most part) I used in school (so none of those nifty libraries/frameworks), to (for the most part) working on a data driven mobile application for iOS/Android. And after working with the Cocoa frameworks, I did say "Holy shit, Cocoa sure made this task easy!" :)