# Mac programming, where do I start?



## Sunnz (Oct 7, 2006)

A very brief background, I were a Windows users few years ago and that was when I learnt Java as my first language. I then done a lot of web scripting like PHP, Flash, etc. As my interest expands I moved on to Linux and have done scripting like bash, python, etc...

I now doing Software engineering in uni and start learning things like doing GUI in Java... have also learn new languages like C, Haskell, Ada...

Got a Mac this semester, and now I want to start learning programming in Mac! I have done some in Ada/C for homeworks... but I want to do real things like Cocoa or whatever... where shall I look?


----------



## Mikuro (Oct 7, 2006)

First, install the developer tools that came with your copy of OS X. (You might want to download the latest version from Apple's web site, although it's a hefty 800+ MB.) That'll give you all the toold you need to design, code and compile Cocoa/Objective-C based programs for OS X. (As well as Cocoa/Java and Carbon/C++.)

The built-in documentation is pretty extensive, but you'll also want some tutorials. When I first learned Cocoa, I found these pages very helpful:

http://www.cocoadev.com/index.pl?HowToProgramInOSX
http://www.macdevcenter.com/pub/a/mac/2003/07/22/cocoa_series.html
http://cocoadevcentral.com/articles/000088.php

Look around each of those sites, because there's a lotof good stuff there. CocoaDev is one site I still use all the time.


----------



## Sunnz (Oct 8, 2006)

Ohh... so objective-c is the norm for OSX programming?


----------



## lurk (Oct 9, 2006)

It is the norm for Cocoa which is the library that all the UI goodness is built around.


----------



## Mikuro (Oct 9, 2006)

Right.

If you already know some C, you should feel pretty comfortable. Objective-C is just like C, but with some additions for dealing with objects.

A lot of people are confused with the relationship between Cocoa and Objective-C, since they tend to go hand in hand. Cocoa is the dominant framework (or API) in OS X, and Objective-C is the "native" language for that framework (for lack of a better word). Without a framework like Cocoa, the Objective-C language isn't worth much, since I don't think Objective-C has any built-in objects at all.

You don't _need_ to use Objective-C to use Cocoa, though. Apple's developer tools allow you to use the Cocoa framework with Java, too.


----------



## Iritscen (Oct 10, 2006)

I also found "Learnining Cocoa with Objective-C" very helpful.  I vastly prefer using hard-copy references over online references.  You just can't read on a screen.  Quick answers are easiest to find in the on-line and off-line Apple Documentation, but I needed an intro to object-oriented programming as well as Cocoa, and this book is the Apple-recommended title for that.

I should point out that this is the most recent edition, and it's for 10.2, not 10.4.  However, very little important material is different aside from the fact the Project Builder is now called Xcode.


----------



## Sunnz (Oct 10, 2006)

What about those little pluggins and stuff people made? Like for Safari, and stuff? Are they Applescript?


----------



## Mikuro (Oct 10, 2006)

You mean things like PithHelmet and Saft? Those are made with Cocoa and Objective-C. I'm honestly not sure if Apple's Cocoa-Java implementation has ALL the same power as Objective-C. You'd have to ask someone more familiar with Java. But these add-ons take advantage of some pretty low-level things. I know, because I've written some myself.


----------



## Sunnz (Oct 11, 2006)

Well, I don't have to use Java... thought I heard OSX has good support for it? Is it true???


----------



## Viro (Oct 11, 2006)

When people say that OS X has good support for Java, they usually mean that the Swing implementation is much much better than that of Sun's own Swing. The reason is because Apple maintains the Java port, not Sun. This allows them to tweak the fidelity of the Swing components, making them look very similar to native components. You also get nice font rendering, something that Swing is finally going to get in Java 1.6 on Linux and Windows, but has been in Java on the Mac since 1.3. 

There are lots of other tiny enhancements to the JVM that make Java on the Mac a nice experience. 

Java and Cocoa .... is just not worth the hassle. There are a lot of Objective-C constructs that do not map onto Java, and it's quite a hack to get Java working with Cocoa.


----------



## Sunnz (Oct 11, 2006)

Well considering that neither Windows nor Linux supports Java "out of the box", (Some distro of Linux have this half-assed version of gcj), OSX is a lot more better supported for Java in a way...

Then it is the best to just use Swing for Java, right? Since I have done C, Objective-C shouldn't be all that hard to learn... I think...


----------



## Captain Code (Oct 11, 2006)

The best way to use Java on OS X is with the Netbeans or Eclipse IDEs.


----------

