Beginning Mac OS X Development


For one of the modules I'm studying at university this semester, I've decided to develop a Mac OS X application.  I am now 6 weeks in to the 12 week project and prior to starting this I had absolutely no knowledge of Objective-C or the Cocoa framework.  Although I had a little experience in other OO languages such as C# and Java, I've never actually developed a fully functional piece of software before.


I've learnt so much over the past 6 weeks and although I'm by no means at the stage where I can teach newcomers all they need to know, I though I'd share my thoughts and experiences with how to get started with developing on the Mac.


The Idea




First things first, you need an idea.  After all, there's no point in learning an entire new language and framework if you're not going to create anything.  I found that once I knew what I wanted to create, reading/watching tutorials and examples became much more clear.


So my advice is, before you even pick up a book or download Xcode, have an idea and make sure you are clear on what you are looking to create.  The process of developing a piece of software can be long and complicated but if you have a good spec before you start then this process will become easier and more manageable.


Getting Started




As I'm sure you are aware, all Mac OS X (and iOS) applications are written in Objective-C using either the Cocoa or Cocoa Touch framework (amongst others).  So you're going to need to know how these work.  Now although Objective-C is a pretty straight forward and relatively easy language, I wouldn't recommend it as your first OO language.  From personal experience, I've found learning the basics of OO programming in a language like Java a lot easier.  But that's just my opinion, if you want to dive head first into Objective-C then go for it, good luck.


The following section details what resources I used to get started.


Resources




The web is awash with information and with the recent popularity of the iPhone and iPad, there are hundreds of tutorials out there that will teach you all about Objective-C and developing for OS X and iOS.  Not all the tutorials and guides out there are good though (and there's usually more than one way to do something so it can be confusing looking at different tutorials made by different people) so I highly recommend you find a particular book/website/tutorial series and stick with it.  Here is a list of the resources I have been using:


Cocoa Programming for Mac OS X 


I can't recommend this book high enough.  It is absolutely brilliant. After reading just this book, I found myself having a fully functional (if very basic) version of the app I wanted to create without even learning the features of Objective-C


People have a lot of great things to say about the guys from The Big Nerd Ranch, and after reading this I fully agree.


Programming in Objective-C 


There are many books out there that solely focus on Objective-C so it can be hard to pick the right one.  I'm not really sure why I chose this one and to be honest I've not really used it that much but it's always satisfied my needs when I've needed it.  Another highly recommended book that I don't actually have is The Big Nerd Ranch's Guide to Objective-C .  Given how good Cocoa Programming for Mac OS X is I'd imagine this is just as good.


AppleProgramming YouTube Channel 


This is a YouTube channel run by a guy named Lucas Derraugh and it is absolutely fantastic.  He covers pretty much everything you can think of when it comes to Objective-C and Cocoa and does so in a very clear and precise way.


This website also covers the basics of Objective-C.



Getting Stuck and Finding Answers




Once you start developing your application at some point or another, you're going to get stuck or have some issues.  With the web, finding answers to an Objective-C or Cocoa related problem can be relatively easy but finding good answers that actually teach you something rather than just giving you the answer can be a little harder.  Whenever I'm stuck there are two places I always go:


The Apple Documentation


The Apple documentation is vast and can be a little intimidating at first but it's a fantastic resource and it's essential you familiarise yourself with it.  Apple document everything in a very consistent fashion, so once you get the hang of it you'll know exactly where to go before you even open it.


The Apple documentation is accessible via Xcode by going to Window > Organizer or via their website.


Stack Overflow 


If you've done any form of development work before then I probably don't need to introduce Stack Overflow but for those of you who have never used it before it is a free programming Q&A site.  It is the place to go for any programming related questions you have.  As Stack Overflow has been on the go for many years now (and due to the popularity of Objective-C) the chances are any question you want to ask has already been asked and answered.  Every time I've googled an Objective-C/Cocoa related question I'm taking straight to Stack Overflow.   With this in mind it's important that you search the side before you ask a new question.  Each question also has links to related and/or link questions so it pays to look through all of these first.


When developing I always have Xcode on one screen and the Apple documentation and Stack Overflow on the other.


Rounding Up




I know a lot of the stuff I've mentioned so far is probably fairly obvious but I know it can sometimes be a little daunting and overwhelming when working on a new platform, particularly one that is so popular and has so much information out there about it.  So it can be nice to read how others cope with it.


I'll try and update this blog as I progress further with my studies and hopefully share some more knowledge and skills that I pick up on the way.  In the meantime, Happy coding!

Comments/question? Get me on twitter