4 ms·
(Some of the responses here are hilarious. I feel like I'm reading a Slashdot thread from 1998.) I think it's interesting to compare Objective-C with Microsof
by thought_alarm 11y ago
(Some of the responses here are hilarious. I feel like I'm reading a Slashdot thread from 1998.)
I think it's interesting to compare Objective-C with Microsoft's COM. Both originated at roughly the same time (late 80s). Both aim to add dynamic, object-oriented features to plain old static C. Both provide a thin runtime library and C-based API to bring those features to C. Both use the same reference-counted memory management. Both allow you to dynamically load objects at runtime, and query about the capabilities of these dynamically-loaded objects in a general way. Both have been integrated into multiple different object-oriented programming languages. Objective-C differs in that it is both a runtime library and a language, where COM is just a runtime library.
COM become hugely popular in the late 90s. While it's natural to use COM to implement a plug-in framework for an app, people started to use COM for everything. This led to the deCOMtamination movement of the early 2000s.
I too did a bunch a COM development in the late 90s, just like everyone else. If I knew then what I know now, I would have ditched COM entirely and used Objective-C and OpenStep. But even if one had a time machine and could travel back to 90s with knowledge of the future, there is no way you could convince anyone else to ditch COM for Objective-C. The syntax is unusual to C, C++, and Java programmers, and there are just too many misconceptions about Objective-C floating around (e.g., see some of the other responses in this thread).
Objective-C has many interesting features that make it ideal for doing the kind of large-scale client-side desktop and mobile app development that it's known for. But I think the truely compelling aspect of Objective-C is the cohesion between the language and UI frameworks that make up Cocoa and Cocoa Touch. The frameworks and the language were developed hand in hand.
Objective-C without the Frameworks isn't compelling to people who aren't already familiar with the language, and those frameworks are (now) only available on OS X and iOS.
- ams6110 11y agoCOM was popular, yes, but it was a nighmare. Remember all the threading models? Here's just a taste: When a free-threaded apartment (multithreaded apartment model) in a client creates an apartment-threaded in-process server, COM spins up a single-threaded apartment model "host" thread in the client. This host thread will create the object, and the interface pointer will be marshaled back to the client's free-threaded apartment. Similarly, when a single-threaded apartment in an apartment-model client creates a free-threaded in-process server, COM spins up a free-threaded host thread (multithreaded apartment on which the object will be created and then marshaled back to the client single-threaded apartment). I remember thinking I sort of understood this back in the day, but now I'm pretty sure I didn't.
- adrianoconnor 11y ago<quote>(Some of the responses here are hilarious. I feel like I'm reading a Slashdot thread from 1998.)</quote> +5 Insightful