tags:

views:

1565

answers:

15

I'd like to start experimenting with Cocoa and programming for Mac OSX. I'm not terribly concerned with Objective C syntax/constructs/bheaviors at this point, but more curious as to an efficient setup on in terms of an editor and/or IDE that will get me going quickly. Is there any IDE even remotely similar to Visual Studio (since that's where I've spent most of my time over the last 7 years) in terms of it's solution/project concept? Any other tools, tips, suggestions and/or resources to get up and experimenting quickly?

I'd like to avoid a lot of the intro stuff and get into things like "If you want to create an Mac desktop application, you can use Acme IDE and set up your project like this."

A: 

AFAIK, pretty much every OS X developer uses Xcode.

That, and Interface Builder for creating the GUIs.

FWIW, try to get hold of a copy of Hillegas's book, as it's a great introductory tutorial, and the reference Docs Apple provides really aren't. (They are generally very good reference docs, however).

Matthew Schinckel
+17  A: 

I'd suggest you pick a fun little product and dive in. If you're looking for a book I'd suggest Cocoa Programming for Max OSX which is a very good introduction both to Objective-C and Cocoa.

XCode is pretty much the de facto IDE and free with OSX. It should be on your original install DVD. It's good but not as good as Visual Studio (sorry, it's really not).

As a long-time VS user I found the default XCode config a little odd and hard to adjust to, particularly the way a new floating window would open for every sourcefile. Some tweaks I found particularly helpful;

  • Settings/General -> All-In-One (unifies editor/debugger window)
  • Settings/General -> Open counterparts in same editor (single-window edit)
  • Settings/Debugging - "In Editor Debugger Controls"
  • Settings/Debugging - "Auto Clear Debug Console"
  • Settings/Key-binding - lots of binding to match VS (Ctrl+F5/Shift+F5,Shift+Home, Shift+End etc)

I find the debugger has some annoying issues such as breakpoints not correctly mapping to lines and exceptions aren't immediately trapped by the debugger. Nothing deal-breaking but a bit cumbersome.

I would recommend that you make use of the new property syntax that was introduced for Objective-C 2.0. They make for a heck of a lot less typing in many many places. They're limited to OSX 10.5 only though (yeah, language features are tied to OS versions which is a bit odd).

Also don't be fooled into downplaying the differences between C/C++ and Objective-C. They're very much related but ARE different languages. Try and start Objective-C without thinking about how you'd do X,Y,Z in C/C++. It'll make it a lot easier.

Andrew Grant
A: 

I was afraid Xcode was going to be the answer! :P I tried playing around with that -- literally just getting it off the DVD and just diving in with no idea what to expect (before I even knew that you used Objective C as the language). I figured, the wise guy that I am, that I could just sort of fumble around and get a simple app working ... wrong.

@Andrew - Thanks for the insight on those config settings. Based on my Xcode first impression, I think those may help.

Peter Meyer
A: 

Yeah I know that feeling :)

If it's any consolation it sounds like we have very similar experiences (7+ years of C/C++ in VS) and my first experience of XCode / Cocoa was exactly the same. I found it took me about two weeks (maybe 10 hours) of reading Cocoa Programming for OSX and working through some of the samples before I really "got" it and started to feel productive.

A good C/C++ background will definitely help in the long term, but in the early days it almost feels like a hindrance as things feel familiar yet wrong :)

Andrew Grant
+3  A: 

The first document to read and digest is the Mem management guide, understand this before moving on. This is a great guide to objective-c too. Infact the developer site at Apple is very good - but you would probably want to read the Hillegas book first.

In regards to Xcode vs Visual Studio - they are different. I wouldn't say one is better than the other - Windows developers come over from VS and expect it to be the same. This is just an arrogant attitude and please don't fall into this crowd. Having used VS since the AppStudio days and Xcode for a year or so now, both have strengths and weaknesses. Xcode is something that out of the box (and especially when coming from VS) doesn't seem that good, but once you start using and understanding it - it becomes very powerful.

Also, there are a lot more tools included with Xcode et al, such as Instruments and Shark that you simply can't get with VS, unless you open your wallet, and even then IMHO aren't as good.

Anyway, good luck. I still enjoy C#, but Objective-C/Cocoa somehow makes programming fun again once you get into it...

KiwiBastard
A: 

Cocoa is huge. The hardest part of learning how to write apps on Mac is learning Cocoa. By the way. You do not need to know ObjC (though it helps tons). You can write Cocoa apps with Python or Ruby (right in the IDE).

I agree VS is a better IDE then Xcode. But if you throw in Interface Builder and all the other tools, I'm not so sure. Mac development is not about 1 giant IDE for everything. But VS is "kinder" on the developer then Xcode is.

Also if you want to do cross platform apps look at RealBasic. A fine tool (Basic though. But it runs on Linux too.) You'd be surprised how many Mac apps are written with RB.

Stephen Cox
A: 

I've heard the books currently out there are pretty out of date. The whole ecosystem seems to evolve very fast with dramatic changes made in every OS release.

He wrote a tutorial which pulls together some Apple documentation and other tutorials which should get you started. I think it covers the basics of using the IDE, writing simple apps, and then goes on to more advanced stuff.

Jay Conrod
+1  A: 

One other suggestion: If you have feature or enhancement requests, or bugs that you've run into, be sure to file them at Apple's Bug Reporter. It's the best way for developers to communicate their needs to Apple, because every issue is tracked through the system.

Chris Hanson
A: 

Thanks all for the additional tips. I'll be sure to check out those online resources.

And, no worries, KiwiBastard, I won't constantly compare Xcode to VStudio, that was merely a reference point. I too remember the early days of Visual Studio as AppStudio and the memories aren't all that pleasant. To give credit where due, I have always thought Microsoft nailed the angle on the developer early on. They still do today. However, I think Apple has nailed usability in the OS for the common user, while Microsoft is finding their way. But, that's an entirely other thread!!

Thanks again, all.

Peter Meyer
+1  A: 

You might try the demo of textmate and see how you like it for working with objective-c or any other type of text really. It will import xcode project settings so you can still compile and run from textmate rather than having to go back to xcode.

crackity_jones
+1  A: 

Xcode is the standard for editing source files, though you can use another editor in conjunction with the command line xcodebuild tool if you really want. I used Vim for all my Cocoa editing before finally giving in to Xcode. It's not the greatest IDE in the world, but it gets the job done, and the recent 3.x releases have had some nice improvements.

The real power tool of Cocoa development is Interface Builder. IB does not generate source code like many UI tools. Instead it manipulates real Cocoa views, controls, and objects which it then bundles into an archive (nib) that is loaded by your program at runtime. Most Cocoa programs use at least one nib file, and often many more.

No matter what IDE/editor combination you choose for hacking on source files, I recommend using IB where you can. Even if you're not a fan of other UI layout/generation tools, I suggest keeping an open mind, giving "the Cocoa way" a chance and at least learning what Interface Builder can do for your development process.

A: 
A: 

@peter I don't know why you had trouble with getting a simple app working, right off the bat without doing anything your app gets a lot of benefits from the Cocoa framework. If you mean you were trying to do stuff like connect a button to an action and have it print a alert on screen or something like that then yes I could see where your going with it being difficult.

The problem for me starting with Cocoa many years back is that it was so different from anything else that it had a little bit of a learning curve. Whereas many other systems are compile time oriented Cocoa is very dynamic and runtime oriented. Once you get past learning how actions hook up to classes it just becomes a matter of learning how the Cocoa frameworks work.

Colin Wheeler
A: 

@mralex - I have never felt more confident about buying reading material! Over the last 3-5 years, I've found that buying tech books is disappointing at times because the market is so flooded with so many on the same topic. Not having the kind of consensus opinion received here leaves you with nowhere to turn but hours skimming books in the store or wading through a ton of reviews online (if there are any.) So, really, thanks for the recommendation.

@Cocoa Samurai - I guess I wouldn't have characterized it as having trouble, but rather I my expectations were centered around my experience with Visual Studio. I did find my way into Interface Builder and tried to create a form of sorts, but to be fair, I was flying by the seat of my pants. So, I really didn't give it the due diligence it deserved, but at the time I was only experimenting. Now, I'd really like to invest a little time and learn, but at the same time, I wanted to be sure I was headed in the right direction. So, I'd say all the information I've received on this thread is fantastic!

Peter Meyer
+3  A: 

Don't bother digging up your OSX DVD as they've released a new version (3.1) of XCode since then.

First, you'll want to join Apple Developer Connection (it's free, and you need it to access their version of MSDN) - it uses your Apple ID so if you've ever had one for the itunes store etc, it's that same username/password

Once you've done that, click on downloads, then click on developer tools, to view this page, and go for the XCode 3.1 Developer DVD

Orion Edwards