which programming language is best?

petr6534
Unregistered
 
Post: #1
I am an intermediate c++ programmer and want to start to develop games and applications for mac OSX. Which language is the best to learn- Carbon, Cocoa, or is there another language that is better?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
Carbon is a C/C++ API, and Cocoa is an API for Obj-C. I'd recommend going the cocoa route, it's far easier to learn. Carbon pretty much just around for porting C/C++ programs and for those who did Mac programming in the pre-OSX days.
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #3
And let's not forget you can integrate Carbon in a Cocoa application. So yes, I second going for Cocoa.

"When you dream, there are no rules..."
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #4
I don't think I really use either Carbon or Cocoa. Technically I use Cocoa for SDL but other than that I'm just using C++. I would recommend Cocoa however as there are some very useful functions to use when reading/writing files as well as other things. The downside to Cocoa is the inability to be easily ported.
Quote this message in a reply
Moderator
Posts: 702
Joined: 2002.04
Post: #5
Or you could just keep your C++ knowledge and use a combination of SDL and OpenGL, and that way target any platform which supports those (Mac OS X, Linux, Windows, and lots of more obscure others...)

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #6
Cocoa/Obj-C if you plan on writing Mac applications

If you plan on writing a game - C/C++ for the low-level graphic routines and either C/C++ or scripting language like Python/Ruby/Javascript for the game logic.

If you are writing a game - look at all the free/open libraries available to you. If you are making a 3d game look at Dim3. If you are making a 2d arcade game look at SDL. Look at cross-platform libraries for your image and audio needs.

good luck!
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #7
ObjC and Cocoa is definitely the way to go for regular user interface programming, and Carbon is the API of choice to access the OS from C/C++. There is no general best way to go, always get the right tool for the job.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #8
I use the diagonalization principle, and for each of their arguments, I take the opposite of what they say, I form a programming language you should use based on that. Since no such programming language exist, you should either:
a) not program
b) program in whatever you damn well please cause I know that most of the time, whatever we say in regards to what a person should program rarely ever changes what they eventually program in.
Quote this message in a reply
Vertizor
Unregistered
 
Post: #9
Everyone has posted some really good advice thus far. All I'll say is:

I'm in the same boat as you, C/C++ is my primary language for over 5 years (4 of it professionally). When I started learning Cocoa, it took me a lot longer to get use to that style of coding than it did to actually learn the concepts, syntax, and Cocoa API. Often I would try to do things that weren't legal in objective-c, or just not how it's suppose to be done.

I then went to learn Carbon for a while. I felt a little more comfortable there because it's at least a language I'm more familiar with. But my stumbling block was the fact that I've been a Windows programmer for so many years, the most notable difference was the way message and event handling was done.

So whatever your background is, if you can let go of old habits it'll be easier. I've done Windows programming, PalmOS, Linux, BeOS. But MacOSX is an entirely new beast to me.
Quote this message in a reply
Vertizor
Unregistered
 
Post: #10
One more thing:

Specifically with game development, I often hear that using the C language is better because there's less overhead. The "overhead" is in regard to object-oriented languages and data structures. Using smaller, tigher, "struct" data types rather than entire classes may yeild more performance than making everything a class. On the other hand, it does limit you feature-wise, of what you can do in code. If you have a good handle on inheritance and code reuse, C++ might be very useful and almost if not as fast a C code.

There's been a lot of talk about which is better performance-wise: Carbon on Cocoa. I use to hang out in other Mac forums and I notice that there's a lot of misconceptions out there. Many Mac users still don't understand that Carbon has been updated for OSX and the Mach-O executable format. Long story short, the binaries are equally fast. But the more you rely on the API and framework, that's where I believe the differences start to be more clear. For example: I wouldn't consider using too many Cocoa classes that encapsulate data types. Like if I wanted to convert a string of text into a float or an int, the C runtime has functions for that type of operation which I'd gladly use over the NSString object to do the conversion.

With Carbon, I'm a little annoyed when it comes to strings. There's a difference between a Carbon string and a C string, and they're not always compatible. So that involves a string conversion routine before the 2 can be interchanged, and that costs time and memory.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #11
Vertizor Wrote:With Carbon, I'm a little annoyed when it comes to strings. There's a difference between a Carbon string and a C string, and they're not always compatible. So that involves a string conversion routine before the 2 can be interchanged, and that costs time and memory.

I'm curious what you mean when you say "Carbon string". There's CFStringRef, Str63, Str255, HFSUniStr255, char * (which I assume is what you mean by C string), UniChar *, and probably a few others I'm forgetting...

Alex Diener
Quote this message in a reply
Vertizor
Unregistered
 
Post: #12
I believe it's the CFStringRef vs. char* that I'm complaining about. Most Carbon functions that take a string argument, such as creating a window and setting its title text, take a CFStringRef. I just remember it being kinda tedious having to convert a char* into a CFStringRef then pass that to the function.
Quote this message in a reply
Member
Posts: 196
Joined: 2003.10
Post: #13
start with java. truly, it's very easy to learn, and the concepts are easily applied to objective c or c++. learn c after java, though - then you'll be able to deal with memory management (very important).
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #14
blobbo Wrote:start with java.
just ask him to be stupid why don't you.... seriously, java is absolutely the WORSE thing you could start someone with. I would suggest basic or assembly over java ANY day.
Quote this message in a reply
Member
Posts: 196
Joined: 2003.10
Post: #15
skyhawk: Java is an excellent choice for learning how to program. It's very intuitive, and the library is large and strong. I found it very easy to learn - certainly easier than any other language I ever tried to learn on prior to it. Just speaking from experience.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  "C the Programming Language" exercise 1-9 Byron Clarke 14 6,190 Sep 24, 2005 10:18 AM
Last Post: PowerMacX