Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moron

macrumors newbie
Original poster
Apr 9, 2003
29
0
London
Hi

I'm a recent mac convert, and i need a little advice about programming languages for the mac.

I've had light-moderate experience programming in Visual C and Visual Basic on the PC, and would be interested in continuing on the mac. What versions of C are available? Are there any freeware/open source C packages available? Does programming C on the mac differ that much from the PC? Does anyone know of any good sites that cater for mac programming, preferably with tutorials so i can get my footing again?

Cheers in advance, and sorry for the noob-style question! :)
 

benixau

macrumors 65816
Oct 9, 2002
1,307
0
Sydney, Australia
no question is to basic. we all start somewhere.

i program for the mac in objective-c under the cocoa framework. apple likes this. It is easy (compared to saay, carbon (c++)) and the apps are fast.

to program with you will need the apple developer tools. you an download the latest at the apple developer site or use the ones from your Mac OS X CD. I would recommend the downloaded ones for compatability and up-to-dateness but it is a 300MB odd download and so is a bit much for D/U connections.

to start off in obj-c. visit cocoa dev.com, cocoa dev central.com and search in google for the O'reily cocoa programming site. It is really really good with downloadable examples to. If you want to see what can be achieved goto the apple cocoa sample code site. If you want any more i can send you a word doc (or rtf if you are anti-MS). I would just need time to type it up.

to continue please email me at benjamingreenau@optusnet.com.au.

good luck
 

moron

macrumors newbie
Original poster
Apr 9, 2003
29
0
London
Cheers chap, i appreciate the speedy response.

I think my OS X cd is still at uni, so i'll start downloading straight away. I'll have a whack at some coding, see if i can get my programming mind back in order. If i get any problems i'll drop you a line.

Thanks again.

Mike
 

irmongoose

macrumors 68030
Just a little tidbit. Things seem to be moving towards Java nowadays, replacing C++ even at our school's programming class. Plus, Java creates cross-platform apps, so no need to code the same thing twice; just tweak it for either platform so it fits in with the overall GUI.



irmongoose
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
Cocoa could be a bit advanced for a newbie (although I really like it). Realbasic might be better.

If you have any problems, post 'em on macrumors and I'll see what I can do.
 

moron

macrumors newbie
Original poster
Apr 9, 2003
29
0
London
Just a little tidbit. Things seem to be moving towards Java nowadays, replacing C++ even at our school's programming class. Plus, Java creates cross-platform apps, so no need to code the same thing twice; just tweak it for either platform so it fits in with the overall GUI.

I have a tiny bit of java experience from one of my degree modules, but i never took to it in the same way i took to C. Also, i'm quite interested in game development, and as far as I'm aware C is better for this (although i may be totally wrong!).

Cheers!
 

bousozoku

Moderator emeritus
Jun 25, 2002
15,718
1,893
Lard
If you were accustomed to doing GUI programming on Windows, you probably used MFC.

On Macintosh, you may programme for GUI in C much more easily than you can programme for Windows in C. You can, of course, create C and C++ programmes for the command line and it's so very simple.

If you know Object-oriented programming, Objective-C is nice although you must learn Apple's nice but rather unusual tools to get anything done. Java is Java--it works equally well on any platform. I think this is the best choice for GUI programming, esp. after spending so much time with Windows.
 

Doctor Q

Administrator
Staff member
Sep 19, 2002
39,788
7,522
Los Angeles
Re: Mac programming languages

Originally posted by moron
I'm a recent mac convert...
This fact conflicts with your MacRumors member name. So I'll assume that your member name moron refers to Morón, the city in Argentina.

REALbasic is one of the easiest ways to get started with Mac programming. The programs can run under Windows too. However, if you are serious about real game development, you should look into the Apple developer tools as benixau suggests.
 

moron

macrumors newbie
Original poster
Apr 9, 2003
29
0
London
This fact conflicts with your MacRumors member name. So I'll assume that your member name moron refers to Morón, the city in Argentina.

:)

Actually its because when i try to sign up for web services, my surname (Morgan) is usually taken, and rather than being morgan_37 or something, i choose something which sounds similar - moron! Of course its ironic, i'm not a moron... :)

I'm downloading the apple tools as we speak, and i have been for 8 hours now. I'm getting a paltry 6kbs down a ADSL line, which is total rubbish. No matter, only 2 mins left. Realbasic does look pretty sweet, but Visual Basic has never offered me the depth i've wanted, so i'll probably jump straight into Cocoa. I'll let you all know how it goes!
 

moron

macrumors newbie
Original poster
Apr 9, 2003
29
0
London
oh my god the download has stopped at 301.2mb out of 302.3mb. I'm ultra suicidal!
 

benixau

macrumors 65816
Oct 9, 2002
1,307
0
Sydney, Australia
dont use RB if you can avoid it. i have it for demoing my app interfaces.

in the end you will want the ease of adding powerful features that only cocoa offers.

as for obj-c vs java: i chose obj-c cause in the 10.1 days the documentation was better by a mile and all of the APIs had not been java-ed.

i find also, that while java is good it can be harder to learn. also, the cross-platform code can slow it down. It also makes the resulting app larger.
althogh, if you need, and i mean absolutely need, cross platfrom compatability then use java or RB (it makes carbon apps, and can compile to OS9, OSX, Win32). just be careful not to use any OSX specific features in java. it will cause massive error. windows for example does not have sheets (duh! they are useful, why would windows have that :D). RB, on the other hand converts the sheets to modal windows etc for pre-OSX and Win32.

good luck.
 

bousozoku

Moderator emeritus
Jun 25, 2002
15,718
1,893
Lard
I would never suggest using Java for Cocoa programming although it can be easier, if you're already familiar with Java. Objective-C takes a little time to understand, even if the runtime coincides with most of what Java is doing, á la Smalltalk.

While I'd never suggest using REALbasic for anything critical, it is a quick way to get things working. The only other thing that works this way would be Borland JBuilder. Drag-and-Drop programming was on Macintosh early and left it early too.
 

benixau

macrumors 65816
Oct 9, 2002
1,307
0
Sydney, Australia
i dont know. i have never ever seriously given java a look. i just know that obj-c has all of the APIs and a few more at last count than java.

besides, if he isnt programming for another platfrom then this doesnt matter. obj-c all the way for mac only programs.
 

moron

macrumors newbie
Original poster
Apr 9, 2003
29
0
London
What about Carbon?

I know almost nothing about it at all, but from what i read about it on the RB page, its as good as Cocoa, and would be better for someone who is familiar with C on other platforms. Would carbon be better for porting PC code to the mac?
 

Fukui

macrumors 68000
Jul 19, 2002
1,630
18
I know almost nothing about it at all, but from what i read about it on the RB page, its as good as Cocoa, and would be better for someone who is familiar with C on other platforms. Would carbon be better for porting PC code to the mac?
Don't fall into the RB trap, if you ever want to sell your app, dont use RB....They say its as "good" as cocoa, but...its not. Objective-C is based on C, if you know C, you can learn Objective-C pretty easily, just give it a try, you'll never know if you don't. And it doesn't really matter for porting code from the PC with regard to Cocoa or Carbon because of you look at apps ported from the PC on mac, some are Cocoa, some are Carbon, for example, apple's "Cocoa-Based" Safari is actually based on KHTML from Linux (written in C++ I believe)! Same for Camino, it was ported from Mozilla, you can wrap command line apps from Linux/Unix easily in Cocoa as well...besides the thing that is really going to limit the portability of your app from say windows is windows specific API's...

You can program in cocoa using Objective-C, C++, Java, and you can mix C code in Cocoa because Obj-C is just a superset of C anyways...and you can access the carbon API's from Cocoa and vice-versa...

Just give cocoa a try, and if its too hard, try carbon...
 

bousozoku

Moderator emeritus
Jun 25, 2002
15,718
1,893
Lard
Originally posted by moron
What about Carbon?

I know almost nothing about it at all, but from what i read about it on the RB page, its as good as Cocoa, and would be better for someone who is familiar with C on other platforms. Would carbon be better for porting PC code to the mac?

Carbon is actually quite good and is easier for Windows programmers to understand. It's not object-oriented but it's a very well-designed framework.

Rather than listening to every message, whether it applies to your application and control, you add a listener for your control and a callback function to handle the event. MFC on Windows does the message cracking but it's not quite as nice as how Carbon handles it. I liked the way you could right click on a control in Borland C++ and found the message you needed to handle, then could use ClassExpert to create the empty handlers. Apple doesn't do anything so automatic, but again, the framework does a lot.

Cocoa has another way to do it which relies on drawing lines in Interface Builder to establish the relationships. If you've worked with Smalltalk or IBM's VisualAge products, you're familiar with this sort of magic, behind-the-scenes coding.
 

benixau

macrumors 65816
Oct 9, 2002
1,307
0
Sydney, Australia
Actually, you will like obj-c/cocoa (called cocoa from now on) better. In carbon to save preferences you must fiind the directory, create a code link to it, create the XML file (a bitch in itself) open it, place the code in, which has to be coded to suit, then close it etc. In cocoa, i just call an API and it finds the correct preferences folder for me, creates the XML file and names it, gives it the correct extension etc it also closes it for me when the app quits.
All i have to do is put the values into a dictionary that is linked to a mutable array (an array that can be changed after it is created).

I belive that obj-c is better. I fully support it and cocoa. BUT - in the end it is your chioce. If you like programming easily where everyhting is done for you almost (sorry, no calculus based code (probably if you look on google)) then choose cocoa. If you like to do it all yourself and have a slower app at the end choose carbon.If you want the slowest possible app, the biggest possible binary/exe and a really expensive app to boot, go RB.

PS. if you go RB i will kill you - i.e. DONT
 

irmongoose

macrumors 68030
Originally posted by bousozoku
Carbon is actually quite good and is easier for Windows programmers to understand. It's not object-oriented but it's a very well-designed framework.

Rather than listening to every message, whether it applies to your application and control, you add a listener for your control and a callback function to handle the event. MFC on Windows does the message cracking but it's not quite as nice as how Carbon handles it. I liked the way you could right click on a control in Borland C++ and found the message you needed to handle, then could use ClassExpert to create the empty handlers. Apple doesn't do anything so automatic, but again, the framework does a lot.

Cocoa has another way to do it which relies on drawing lines in Interface Builder to establish the relationships. If you've worked with Smalltalk or IBM's VisualAge products, you're familiar with this sort of magic, behind-the-scenes coding.

Yada yada yada... you programmers really confuse me! SPEAK ENGLISH!



irmongoose
 

Doctor Q

Administrator
Staff member
Sep 19, 2002
39,788
7,522
Los Angeles
Originally posted by irmongoose
Yada yada yada... you programmers really confuse me! SPEAK ENGLISH!
Sorry, but we programmers don't understand your language either. We only understand words like grep and blog and foobar and QueuePointerIndexHandle. Most of the time, we only speak in TLAs (where TLA is a three-letter acronym for "three-letter acronym"). When you normal people use strange words like "quality software" and "on-time project completion", we have no idea what you mean.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.