How do you write program for Mac OS X? - objective-c

Hi just wondering how do you start writing programs for MAC OS X?
what language does it use? can I use objective C? which IDE do I use? any licensing fee should I know about.
Thanks.

Mac OS X is a great programming platform, as such you can use just about any language you like.
If you wish to write native applications using the Cocoa framework you'll probably want to be using Objective-C. You can download XCode as an IDE for free.
No licensing fees.

Xcode is the apple supplied IDE, and without external libraries some objective C is always required to build applications.
That being said xcode supports multiple types of langauges, and has extensions for many more - and C++ can be spliced in with objective C code - so if you prefer to code in C++ you can write a quick objective C wrapper and do all your own stuff in C++ - or indeed the langauge of your choice. There are a few other open source IDE's but I don't really recommend them - most of them crash on opening in new versions of Mac OS X.
Xcode is found in the developer package on your second mac install disk, or the latest version (with iphone SDK's) can be downloaded once registering on the Apple Developer Website, which you can become a basic member of for free.
As far as licensing goes, unless you plan to make a game for iOS there are no liscensing fees, unless you want a full subscription to apples developer website, which gives you a few extra things from them.
If your trying to write a game, consider using the SDL library, a cross platform wrapper for whole lot of operating system interface functions, including graphics - or you can use it as I do in combination with OpenGL for full 3D Support, hardware acceleration, ect.

Objective-C + Cocoa
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html
Apple suggests XCode

The native libraryfor OS X developed by Apple are called Cocoa. It provides OS X's graphical user interface, and other libraries such as Core Data for database acess, Core Animation for fast easy animation and video features in your software. These libraries are written in a mixture of C and Objective C (which is an extension of the C language). For best performance and best integration with the Mac operating system you should probaby look at developing in C, Objective C and perhaps some C++ as well.
There are some add-on layers that provide acces to the Cocoa libraries from other languages such as Ruby or Python. These are generaly of good quality and work well, so you can use these languages if your aplication does not need the very best performance. They are generaly considered to be easier to learn than the C family of languages and you can become productive very quickly.
Beyond that, you can use languages and toolkits that are platform-independent so your software will can run on Linux or Windows as well as the Mac. For example Python comes with a simple built-in GUI toolkit called Tkinter. You can use more powerful cross-platform toolkits such as Qt or WxWidgets with C or C++ but have excellent bindings for Ruby, Python and other langauges. This is an approach I am using of a project, with Python and Qt.
Others have mentioned Apple's integrated development environemnt (IDE) called XCode. I have only toyed with it, but it looks very powerful for true native development of Cocoa applications.

Related

Can Objective-C be used for non-Apple programming?

Java, C, C++ etc can be used for several types of computers and even mobile phones.
But, can Objective-C be used for anything except Apple products? Could I make an Objective-C program for a Windows machine (or linux), just like I do for java?
This link should answer your question: gnustep.org.
In short:
The purpose of this project is to create a free and open version of
the Cocoa (formerly known as NeXTSTEP/OpenStep) APIs and tools for as
many platforms as possible.

objective c on windows and gcc

Is the gnu objective c compiler for windows the same as the compiler for Mac OS X (and Ipad)?
I want to write some code on windows and run it on the mac and ipad, objective C seems to be the best way to go for the Mac/Ipad but is the gnu compiler the same? I know the libraries cocoa etc are not available but this is not an issue we'll be writing different interface code for each platform (please no comments about this is not the right way etc).
tia,
Dave
The compiler is more or less the same, but the runtime systems are different. If you don’t use the new features from Objective-C 2.0 your code should work fine with both runtime systems. If you want to use the new features you have to use a different runtime. You can find more information here on the GNUstepWiki.
But you still need a framework that provides basic objects like strings, arrays, dictionaries and so on. You could use this part from The Cocotron, a framework that tries to make all of Cocoa available on Windows, Linux and other platforms.

Are Apple platforms the only place Objective-C is a good choice?

If you are not developing for an Apple platform, are there reasons to choose Objective-C? I know of GNUstep (which I do not find visually pleasing), but what else is there?
If you want to develop for multiple platforms, including OS X or iOS but also Linux or Windows, when might Objective-C be a good choice?
Outside Apple, The only major Objective-C environment is GNUSTEP/Windowmaker.
It's a shame, since Objective-C is a much nicer and saner language than C++.
Take a look at Cocotron, which is a port of Cocoa to Windows. If the Mac is your main target, this may be a way to get Windows as well. But, Apple platforms are the best place for ObjC -- if you aren't targeting Apple, I wouldn't use it.
There is The Cocotron
Clozure Common Lisp (CCL) on 32-bit Windows platforms now includes experimental support for the Cocoa frameworks using the Cocotron open source project.

difference between carbon and cocoa?

What is the difference between carbon and cocoa ? For what type of applications we should use carbon and for what type of applications we should use cocoa ? Which is the best of both for developing applications in Mac OS ?
Short answer: For a new application, use Cocoa. Some legacy code may still use Carbon and if you don't need any new capabilities, it will continue to work.
Cocoa has an Objective-C API, and can be accessed from C and C++ code easily. Carbon is a pure-C API. There are both Cocoa and Carbon bindings for many other popular languages, but there are often some limitations.
Carbon is evolved from the original API for the original Apple Macintosh (and Apple Lisa) in the early 1980s. Specifically, when Mac OS X was released, Apple was unable to support some of the legacy Mac OS API functions, but provided a subset of legacy APIs called "Carbon", to ease the transition for developers who had pre-Mac OS X applications. They added thousands of new APIs and continued to fully support Carbon for several years, before finally deprecating it more recently. They have always said that Carbon is a dead-end and all developers should move to Cocoa.
Cocoa has evolved from the NextStep framework that Apple acquired and used as the basis to create Mac OS X. It's the "native" API for Mac OS X and the only way to access some of the newest capabilities.
Carbon was created to ease the movement to and from Mac OS 8 and 9. If your code needs to run under OS 8 or 9, then Carbon is the way to go. (Source)
However, if your software is designed for OS X, then you should emphasize Cocoa over Carbon.
Carbon is deprecated (it does not and will not exist in 64-bit).
For new application development, use Cocoa (I'm talking about native OS X application development the Apple-sactioned way. Obviously other alternative choices exist, such as Java, Python, Ruby, etc, which may be effective depending on your project type if a native UI is not required)
It depends on the scope and the functions of the application you're going to develop.
I'm going to be building an application that makes use of MacInTalk capabilities and the new OSX 10.7 international set of voices. The official documentation states that fine-tuning is provided only under Carbon APIs, while Cocoa APIs are more limited.
Specifically, these Speech channel settings are alterable via API in Carbon: rate, pitch, pitch modulation and volume attributes. This possibility seems to be unavailable via Cocoa.
On a side note, the most updated documentation of the Speech Synthesis Programming Guide dates back to 2006 and it might be the case that Cocoa access to the same functionality is out there, but it's not yet documented.

Game programming on Objective-C and linux

I'd like to give Objective-C a try in game programming. The problem is I'd need some tools and libraries for this.
First thing that comes into mind I need is the GUI and graphics library.
What choices do I have?
There are Four non Mac implementations of OpenStep/Cocoa type Objective C platforms:
OpenStep/NextStep : Openstep/NeXT support machines only - Discontinued.
p..... can remember name or find it on web - it's out there somewhere ! - Linux
Cocotron - Windows only
GNUStep Linux/Windows
GNUSTep is the way to go for Linux... I mention there others because 2 and 3 are available in source and they can be used to patch holes in code the GNUStep doesn't have and they might.
When it comes to Graphics library - you may have problems because Apple moved away from the old OpenStep APIs and has kept evolving their APIs far faster than the GNUStep people can play catch up. There is no support for the latest graphics libraries such as Core Animation.
As Objective C is C and C++ friendly you can use any of these libraries as is, or by making the Objective C friendly by making a wrapper.
You may or may not want to be Mac compatible and do versions for that so it may not be important.
If you do you might want to do a Linux Wrapper for something like OpenGL if it is missing, which I think it is but have a check yourself....
There are Linux development tools including a project IDE and GUI builder for GNUStep on Linux.
Tony
I believe you're asking for GNUStep.
SDL is a C library which is popular for game programming.
If you're looking for Foundation/AppKit stuff you can also look at Cocotron. I've never tried it though.
Supporting SDL there are Objective-C bindings here. However since Objective-C is a thin OO layer on top of C you can use most of the existing C libs for game development, SDL, Clanlib, etc...