Re: Obj-C vs Java- how about ObjC vs C++
Re: Obj-C vs Java- how about ObjC vs C++
- Subject: Re: Obj-C vs Java- how about ObjC vs C++
- From: "Dennis C. De Mars" <email@hidden>
- Date: Tue, 24 Jul 2001 07:57:45 -0700
on 7/24/01 6:50 AM, Vladimir Makovsky at email@hidden wrote:
>
What is gonna happen to existing apps written in C++ for classic? Should be
>
ported to Obj-C?
The vast majority of those applications will simply be ported to Carbon.
There will be some that will port to Cocoa when Obj-C++ becomes available.
>
and that's what bothers me most...
>
>
Does Carbon give performance impact vs. Cocoa (because it's one more layer)
>
or not really?
Not really. You can find some examples of Carbon apps with performance
problems, but you can find others, like iTunes and GraphicConverter and
quite a few others, that are just fine. The main problem now is that there
are some differences between Cocoa and Carbon in features supported, default
behavior, etc. Apple is in the process of resolving these issues. So, if
what you are worried about is that all of these Carbon apps are going to be
substandard in some way, I don't think that will be the case, a Carbon app
can be a cool OS X app (with more effort than it takes for Cocoa). Which is
fortunate, because most of the initial wave of apps are Carbon.
BTW, Carbon is not "one layer above" Cocoa, as your question implies you
might be thinking. Carbon and Cocoa both access OS services like Core
Graphics, some Foundation stuff was factored out of Cocoa and used by
Carbon, Cocoa actually calls Carbon to perform some functions -- in other
words, at the programmer API level it is really a complex web that ties
Cocoa and Carbon together.
The other idea I think you were implying (although you didn't directly say
it) is that there should be some sort of C++ interface for Cocoa. In my
other reply on this thread, I discussed the fact that an object-oriented
framework (like Cocoa) is harder to interface to other languages than a
procedural interface because programming for an object-oriented framework
requires subclassing framework classes, etc. which in turn is tightly bound
to the run-time behavior of method dispatching of the language in question.
Cocoa is a framework written in Obj-C. Apple developed, at great effort, a
bridge to Obj-C from Java to try to provide a second language for Cocoa
programming. A "C++ bridge" would be nearly impossible because the
difference between the concept of "class" and the way method dispatching is
done is just too different between C++ and Obj-C.
This is just a trade-off that is inevitable, with today's technology, when
you are using an object-oriented framework. You get the advantages of
object-oriented programming, but in order to get these advantages, you are
restricted in your choice of language.
- Dennis D.