Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Would I be crazy to start a new project in Carbon instead of Cocoa?

Would I be crazy to start a new project in Carbon instead of Cocoa?
Thread Tools
Junior Member
Join Date: Jan 2002
Status: Offline
Reply With Quote
Feb 9, 2005, 02:54 PM
 
I am an experienced C programmer from Windows. I have never done any OOP. I am now a Mac devotee, having used the platform exclusively for the past three years. Now, I'm interested in coding a bit for the Mac.

Basically, I'm wondering if Apple is going to continue supporting Carbon indefinitely, or if it has plans to phase it out and only support Cocoa. If this is the case, I would have to suck it up and learn Obj-C and OOP, but I'd rather not do this.

Is there any limitation with Carbon as to interface access? Any other major problems with sticking to Carbon before I get started? I'd love to hear some opinions.

Thanks!
     
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Feb 9, 2005, 03:26 PM
 
Carbon will be around for a long long time, it's still being added to, and has access to more stuff (in general) than Cocoa. Also, Carbon and Cocoa can be mixed in a project. The main reason people use Cocoa is not what can be done, but how easy it is to do it.
     
Junior Member
Join Date: Jan 2002
Status: Offline
Reply With Quote
Feb 9, 2005, 04:45 PM
 
Funny how things are when you're used to something eh?

I am intimidated by learning Cocoa, others use it because it's easier! Amazing
     
Mac Enthusiast
Join Date: Nov 2003
Status: Offline
Reply With Quote
Feb 9, 2005, 05:09 PM
 
Originally posted by Propofol:
Is there any limitation with Carbon as to interface access? Any other major problems with sticking to Carbon before I get started? I'd love to hear some opinions.
As somone who still uses Carbon on a daily basis for development, I can assure you that Carbon is complete enough to write a fine desktop application. That being said, yes, there are a number of APIs that are in development and you have to be comfortable reading Carbon's headers to look for new/updated APIs. You'll also probably want to target Panther, as Carbon really moved forward in that release (e.g. Pasteboard Services support, full MLTE support). you can target Jaguar, but -- depending on your app -- you may have to dynamically limit some features.

Personally, I think the biggest difference is in UI widget support, but there are always ways to "roll your own." And of course, you can always load Cocoa bundles directly into your app if you really need to touch Cocoa (I do this to access WebKit).

Given the number of major legacy apps written in Carbon, I doubt Apple will ever dare abandon it.
(Last edited by saddino; Feb 9, 2005 at 07:45 PM. )
     
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Feb 9, 2005, 06:38 PM
 
You're going to need to learn object oriented programming no matter which way you go. I'm not sure how you programmed Windows apps without OOP, but both Carbon Cocoa make extensive use of OOP. So I'd recommend learning Objective-C and Cocoa as your first object oriented language and API, since ObjC is a lightweight superset of C and Cocoa is a large and mature API. Since you have no investment in C++, going directly to Cocoa just makes more sense.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Feb 9, 2005, 07:57 PM
 
Originally posted by Thinine:
You're going to need to learn object oriented programming no matter which way you go. I'm not sure how you programmed Windows apps without OOP, but both Carbon Cocoa make extensive use of OOP.
Carbon is in C, which is a prodecural language. You can program Carbon using OO techniques, but it doesn't really force it. It's definitely more ADT than OO.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Junior Member
Join Date: Jan 2002
Status: Offline
Reply With Quote
Feb 9, 2005, 08:10 PM
 
Originally posted by saddino:
That being said, yes, there are a number of APIs that are in development and you have to be comfortable reading Carbon's headers to look for new/updated APIs.
So, are you saying that the new APIs are not documented in some sort of formal documentation and that I have to sift through headers in order to see functions that are available to me?
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Feb 9, 2005, 08:43 PM
 
There is extensive documentation, but it's sometimes a little bit behind the actual APIs, so you'll find things in the headers that aren't mentioned in the documentation. (That's as far as I know, anyway. Maybe Saddino has more to add.)
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Mac Enthusiast
Join Date: Nov 2003
Status: Offline
Reply With Quote
Feb 9, 2005, 10:17 PM
 
Originally posted by Propofol:
So, are you saying that the new APIs are not documented in some sort of formal documentation and that I have to sift through headers in order to see functions that are available to me?
There is ample offline (HTML and PDF) and online (HTML at developer.apple.com) documentation, but to be honest, Apple had only recently (since Jaguar IMHO) really started to concentrate on good documentation. If you're used to MSDN, you're going to find Apple's dev docs a bit sparse. Unfortunately, it is also not uncommon to find a disconnect between the docs and the headers, especially when it comes to whether an API call is supported in a given release of the OS.

Apple does include preprocessor defines to compile against and make sure you're targeting 10.2, or 10.2.8 or 10.3, etc. but there are errors. My advice is to rigorously test your code on your target OSes just to make sure (e.g. I found a PDF parsing API call was not supported in 10.2 although it was defined -- and documented -- as being supported).

I'm old school, so I usually am very comfortable checking the headers for prototypes instead of going to the docs. YMMV.
     
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Feb 10, 2005, 12:04 AM
 
Originally posted by Chuckit:
Carbon is in C, which is a prodecural language. You can program Carbon using OO techniques, but it doesn't really force it. It's definitely more ADT than OO.
Okay, you're right: you can write Carbon programs without OO code. But why would you want to? OOP makes things soooooo much easier, especially with complicated GUI programs and modern operating systems. I don't know why anyone would insist on only using C to program in this day and age.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Feb 10, 2005, 02:19 AM
 
Originally posted by Thinine:
Okay, you're right: you can write Carbon programs without OO code. But why would you want to? OOP makes things soooooo much easier, especially with complicated GUI programs and modern operating systems. I don't know why anyone would insist on only using C to program in this day and age.
Personally, I love OOP. But it does have its strengths and its weaknesses. This is how the whole field of design patterns came about.

Many non-OO languages are quite popular. Fortran, another procedural language, is still very big in engineering environments. And Lisp, a functional programming language, is widely acknowledged as one of the most powerful languages out there (if not exactly the simplest). OOP isn't a silver bullet.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Feb 10, 2005, 09:41 AM
 
Originally posted by Thinine:
Okay, you're right: you can write Carbon programs without OO code. But why would you want to? OOP makes things soooooo much easier, especially with complicated GUI programs and modern operating systems. I don't know why anyone would insist on only using C to program in this day and age.
If you have a decent set of templates to cover the basic event handling, it's not really harder than OOP, just a bit more tedious. And it can be easier to optimize.

I say use what you are good at and what you enjoy.
     
Fresh-Faced Recruit
Join Date: Nov 2001
Location: home
Status: Offline
Reply With Quote
Feb 11, 2005, 12:50 PM
 
Propofol, I have developed in C on Windows so I know where you are coming from. If you really want something that resembles Win API, stick with Carbon. However, ObjC/Cocoa is far more sophisticated, easier, and intuitive than Carbon and Win API. True, Carbon has more access to Apple's APIs, but Cocoa apps can easily integrate with Carbon. Developing in Win API seems archaic compared to Cocoa. Cocoa, for you, will have a high learning curve since you are used to doing things in C (as I was too). Yes, it'll take a while to get comfortable with ObjC/Cocoa, but I feel it is worth it. Being dogmatic of sticking to C is pointless when you can be far more effective in Cocoa.
     
Junior Member
Join Date: Jan 2002
Status: Offline
Reply With Quote
Feb 13, 2005, 08:45 AM
 
So is there a high quality, comprehensive book out now (or coming out soon) that would give a C programmer a good start in ObjC/Cocoa? I didn't see anything at first glance on Amazon that I thought would fit my needs, since the ones that looked promising were published over 2 years ago, and I thought XCode had changed significantly since then.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Feb 13, 2005, 08:52 AM
 
http://www.cocoadev.com/index.pl?CocoaBooks is the most comprehensive list of Cocoa books out now.

http://www.cocoadev.com/index.pl?BookCocoaProgMacOSX is highly recommended, and the second edition is less than a year old.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Feb 13, 2005, 08:56 AM
 
Originally posted by hayesk:
If you have a decent set of templates to cover the basic event handling, it's not really harder than OOP, just a bit more tedious. And it can be easier to optimize.
Premature optimization is the root of all evil.

I say use what you are good at and what you enjoy.
Uh, why restrict yourself because you're afraid of learning something new? You'll be forever limiting what you can achieve.
     
Junior Member
Join Date: Jan 2002
Status: Offline
Reply With Quote
Feb 13, 2005, 09:18 AM
 
Angus_D, Thanks for the links!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:09 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2