Objective-C Question
Objective-C Question
- Subject: Objective-C Question
- From: Jeff Galyan <email@hidden>
- Date: Thu, 18 Sep 2003 13:34:30 -0700
I know this list is targeted to Cocoa framework questions rather than
Objective-C "newbie" type questions, so please forgive the somewhat
off-topic post.
Here's what I'm trying to find out:
I've been working with Cocoa and ObjC for some time, and I have yet to find
a really compelling reason to abandon C++. Now, before the semi-religious
flames erupt, please finish reading and give some thought to what I'm
asking.
I've been searching the web and bookstores for something that would explain
what real benefits (if any) ObjC provides over C++; i.e., what makes ObjC
"better" and why. All I've found so far have been feature lists (ObjC uses
dynamic typing, categories, etc.) but no explanation as to why those make
ObjC "better," responses that ObjC "is just better" (not helpful at all), or
zealous accusations of heresy for simply asking a perfectly valid question.
I have yet to find an actual well thought out comparison of the two
languages that showed either was *actually* any better or worse than the
other (or any other OO language for that matter). I have also not found
anything that addresses the very common situation where a vendor has to
maintain their application on both Mac and Windows (obviously, UI code will
be factored out and different for each platform, but the core code can
almost always be common), which has traditionally meant using C++ for
everything. In this (again, very common) situation, what benefit would
there be to the developer to migrate their code to ObjC? I've seen all the
"you shouldn't mention Windows on a Mac mailing list" and similar responses
before, and they really aren't relevant to the question of benefit to the
developer, so please try to be constructive in your replies.
So, short recap:
- *what* makes ObjC "better" than C++? Please try to answer objectively,
avoiding semi-religious fervor. I already understand that most of you
seriously dig ObjC.
- *why* do those features make ObjC "better" than C++? (for example, why
should I care about dynamic typing? Isn't defining a message parameter or
return type as "id" the same as a method/ function parameter/return typed as
"void *"? Don't you still get some kind of error if the passed object
doesn't respond to the given message? Why should I care about categories?
I don't need the base class' source code to derive from it in C++, so what
makes that ability of ObjC so special?)
- *when* are those features useful? For all applications, or only a very
specialized subset of applications?
- Many of the responses will, I'm sure include references to the various
Cocoa frameworks. That's great; however, there are plenty of great C++
frameworks for Mac development as well (such as MacApp or PowerPlant). If
you refer to the Cocoa frameworks, please also be knowledgeable about the
available C++ frameworks and how they differ, and provide some sort of
objective comparison (again, "it's just better" isn't particularly helpful
-- *why* is it better?).
- References to C++ ABI changes are, so far as I know, only relevant to gcc;
I am aware of no other C++ compiler on the market which is link-incompatible
with any other (non-gcc) C++ compiler on the same platform. For example,
Metrowerks' C++ compiler on Mac is compatible with MrCpp (from the Classic
days) and versions of gcc. Even Microsoft's C++ compiler hasn't changed its
ABI as they've brought it into near-total ISO compliance; that is, C++
compiled with earlier versions of VC++ links just fine with code compiled
with newer versions of VC++ (as well as any other Windows C++ compiler that
is not based on gcc), and C++ can be built into shared libraries (DLLs).
Since that's not really relevant, I'd prefer if none of us got into any
arguments about it.
To be clear, I have nothing against ObjC in and of itself; I merely don't
see any tangible superiority to it as a language or runtime environment. If
the "benefit" of it is cool frameworks, that's not much of a benefit
vis-`-vis C++ frameworks, or even C frameworks (ref. Jim Trudeau's "EasyApp"
C-based framework for teaching Mac Toolbox programming).
What I'm asking here is akin to someone asking why a wrench isn't a good
tool for driving nails: it can be done with a wrench, but a hammer is a
better tool because hammers generally have longer handles which provide
greater leverage, which translates to greater force delivered to the head of
the nail, and hammers also have a broad, flat striking surface which
improves the ability of the user to drive nails efficiently. An explanation
similar to what I've just written regarding hammers vs. wrenches for driving
nails would be great.
I'm sure additional questions will come up as people reply. If you'd prefer
not to have those additional questions posed to you, please say so in your
reply so I don't waste your time and mine.
Big shout out to jcr!
Thanks in advance to all who reply,
--Jeff
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.