Re: Cocoa from C++ (dont want to mix it)
Re: Cocoa from C++ (dont want to mix it)
- Subject: Re: Cocoa from C++ (dont want to mix it)
- From: Charlton Wilbur <email@hidden>
- Date: Fri, 11 Mar 2005 10:13:22 -0500
On Mar 11, 2005, at 6:28 AM, Dominik wrote:
Well, a friend asked why C++ is not used instead of learning a new
language.
I couldnt give him a sufficient answer.
The short answer is that C++ does not have the same kind of object
model that Objective-C does. In particular, C++ wants to make a lot of
decisions about what types things are at compile time. Objective-C
defers most (all?) typing decisions about objects until runtime, though
declaring what types things are gives the compiler information it can
use to issue warnings, and then throws an exception or otherwise
complains when you try to do something the type system doesn't support.
There's also a lot of history behind it. In the mid-1980s, before
Microsoft got on board with C++, the debate was whether this run-time
typing was an acceptable tradeoff. Processors weren't nearly as fast
then; compile-time type checking meant that the language and compiler
were more complex, and compilation took longer, but stupid bugs got
found at compile-time rather than run-time and programs ran slightly
faster. People who thought runtime type checking was an acceptable
tradeoff used Objective-C (or another language with run-time typing);
people who thought it wasn't used C++ (or another language with
compile-time typing). C++ added a lot of features to deal with this -
the ugliest is probably templates, but there are several ugly parts of
the language that are there primarily because of the emphasis on
compile-time type checking. When Microsoft got behind C++, that was a
strong vote in favor of the language and a reason for many people to
learn it; NeXT preferred Objective-C.
Practically speaking, if you understand C++, the overhead of learning
Objective-C is probably 20 minutes when you start out and 5 to 10
minutes here and there as you discover places where the C++ way of
doing things is not right for Objective-C. You'll spend a lot more
time than that just getting your head around just Cocoa memory
management. Cocoa is designed to play to the strengths of Objective-C,
and rewriting and redesigning it so that people who already know C++ do
not have to spend 20 minutes to an hour learning a few details about
Objective-C is just not an effective use of Apple's time.
Charlton
--
Charlton Wilbur
email@hidden
email@hidden
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden