Re: Objective-C Question [long]
Re: Objective-C Question [long]
- Subject: Re: Objective-C Question [long]
- From: Dave Thorup <email@hidden>
- Date: Fri, 19 Sep 2003 13:49:25 -0600
I thought that I'd address some of the issues that others have not yet
addressed on this topic. A little background about me: I learned how to
program with Pascal (yuk) and then C++, began professionally programming in
C++ and I now professionally program in Java while I do my personal
programming in Objective-C. So I've worked with most of the mainstream
languages and there are aspects that I like about each of them.
On 9/18/03 2:34 PM, "Jeff Galyan" <email@hidden> wrote:
>
I've been working with Cocoa and ObjC for some time, and I have yet to find
>
a really compelling reason to abandon C++.
There may not be a compelling reason that anyone can give you to abandon
C++. I believe that any given task may be solved better by one language
than another. I don't think that there is, or will ever be, and end-all,
be-all, do-everything programming language. If C++ suits your needs and
solves the problems well, then stick with it. If there is another language
that does it better or easier, then use it.
>
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 case it may be best to use C++ over Objective-C. If you are trying
to maintain the core of the application (minus the UI) for Windows, Mac,
Linux and other platforms, then it may be best to do that in C++. I don't
know of any mainstream Objective-C compilers for Windows (I am not a Windows
programmer) aside from gcc, which may not integrate well into your favorite
Windows IDE. You can also use Objective-C++ on the Mac to easily integrate
your C++ core with a Cocoa GUI.
>
In this (again, very common) situation, what benefit would
>
there be to the developer to migrate their code to ObjC?
There may be none, especially if you'd have to rewrite your C++ core.
However, if you are starting a new application from scratch, then the
reasons that others have already suggested may make it worth it to use
Objective-C.
>
- 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?).
Note: This part isn't so much about Objective-C as it is about the Cocoa
APIs.
In my experience the Cocoa APIs (Objective-C) provide for a far greater
experience on Mac OS X than anything else. As a developer, many things are
provided "for free" with a Cocoa application: Mouse scroll-wheel support,
spellchecking in all text views, Services support, etc. Sure, you can do
these things in a Carbon application, but they don't come for free.
As a developer, you can use Interface Builder to create most of your GUI
without any code. For example, you can create a web browser using WebKit
without a single line of code. This allows you to focus on your core
application instead of the GUI which can save a lot of time.
From what I've heard, aside from Carbon, any other C++ GUI frameworks (Qt
for example) don't create applications that are Mac-like.
>
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...
So then, if you've found the tool that suits your needs then use it. If it
can be done better and easier in Objective-C, then use it. If it can be
done better in Java, then use it. If it can be done better in assembly
(shudder), then use it. It all depends on what you're trying to do and
which tool is better suited to the task.
As for me, I started learning the Cocoa APIs using Cocoa-Java (because I was
more comfortable with Java). I then started learning Objective-C and found
it a great way to create an OS X application. Since I'm not (yet) a Windows
developer I don't have to worry about creating a cross-platform core (none
of my apps, Defaults Manager or HyperSpell, would make sense as a
cross-platform app anyway).
This post by Bill Bumgarner explains why he chose Cocoa/Java for an
application over Java/Swing, Cocoa/ObjC, and Cocoa/Python and is a good
example of how to choose the right tool for the task:
<
http://cocoa.mamasam.com/COCOADEV/2003/04/1/61262.php>
For me, it all depends on the application and what tools will work best for
it.
____________________________________
Dave Thorup
Software Engineer
email@hidden
www.kuwan.net
Defaults Manager - The premier editor for Mac OS X's User Defaults /
Preferences database.
_______________________________________________
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.