PDA

View Full Version : Questions About Cocoa and Mac Programming




Fender2112
Jul 25, 2003, 09:37 PM
I have wanted to learn Mac programming for a long and have never taken the time to do it. A few weeks ago I decided to embark on this adventure. I am currently take an online course for C++ at CodeWarriorU.com and well be taking a C++ course this fall at a community college. I chose C++ because I understood it to be the language of chioce for Mac programming.

Tonight I was at a local book store browsing some books on Cocoa. Several of the books mention Objective-C as being the prefered language for Cocoa programming.

My questions:

1. How different are C++ and Objective-C?
2. Which should I focus on?
3. What would be an appropriate path to take to learn Mac programming.

I'm doing this as a hobbie, not as a career. As such, I will only be taking even classes or online selfpased courses.

I will be most greatful for any advice.



Vlade
Jul 25, 2003, 11:33 PM
I am programming in Objective-C/Cocoa right now, and all I can say is its awesome!!! I haven't done much with C++, but if your doing Mac Only stuff (not porting to PC) than Object-C/Cocoa is better with Project Builder. I recomend you stick with c++ because Code warrior was made for it, and Project Builder was made for Cocoa mostly.

I have to go now, sorry for the brief reply.

shake
Jul 28, 2003, 09:02 PM
stick with C++... what you will learn about object-oriented programming will benfit you when you eventually start using cocoa(obj-C). I am also taking programming as a hobby in school. I took Java, then C, now C++... once you know the ideas in object oriented programming, obj-C is not that bad.

cubist
Jul 28, 2003, 09:45 PM
Just to clarify: Both Objective-C and C++ were born as object-oriented extensions to C. They are completely incompatible with each other, but both can work with C.

If you have CodeWarrior, you can use C++ with libraries to work with Carbon. If you wish to use the Cocoa libraries, which they call "frameworks", you must use Objective-C.

The original purpose of Carbon was to make it easier to port existing (legacy) Mac code to work with Mac OS X. As such, the Carbon API is complicated for new programmers. I was disappointed in the CodeWarrior tools for learning Carbon; they are much like pointing to the pedals on a bicycle, saying "put your feet here", end of lesson.

The O'Reilly book "Learning Cocoa" has surprised me by being much better than I expected. It explains things.

I've been programming C since well before the Mac ever appeared, so I'm not a novice programmer. Of the two, I think that Cocoa does appear to be a faster way to get from square zero to a working program.

If you're concerned that it will be a Mac-only program, there is a GnuStep project underway which may lead to cross-platform compatibility of Cocoa applications.

Vlade
Jul 29, 2003, 12:17 PM
Originally posted by cubist
Just to clarify: Both Objective-C and C++ were born as object-oriented extensions to C. They are completely incompatible with each other, but both can work with C.


Actually you can program in Objective-c++, but its pointless and compile times take FOREVER

Catfish_Man
Jul 29, 2003, 01:14 PM
For a hobby, Objective-C/Cocoa will be infinitely more fun and intuitive than C++/Carbon. C++ is powerful, but it does crazy things with pointers, and has some really weird difficult to understand things. Objective-C and Java are both easier and more fun. I'm writing a Newtonian gravity simulator in Cocoa. It's about 50 times as cool as any other program I've worked on, while using about the same amount of code and not taking as long.

johnnowak
Jul 29, 2003, 01:37 PM
I personally am avoiding Cocoa, at least for now, for reasons of portability.

But yes, for OS X, Objective-C is probably the way to go.