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

ShedoSurashu

macrumors newbie
Original poster
Oct 8, 2011
4
0
Hi all, I recently got a mac and am starting to try to learn Objective-C. The problem is, I find it so alienating that I can't grasp the concept behind programming in Obj-C. i guess it may be because of the way things are done in there vs the things done in other programming IDEs / languages (in Windows at least).

For example, I tried starting with a new test application and it created like a dozen files. I've only gone as far as creating the app's layout with Interface Builder.

All in all I just find it really intimidating having moved from a Windows environment and from how things are done on the common Windows programming IDEs. I can't even figure out where to put my functions lol.

I need some enlightenment from someone who has been through this kind of struggle with moving. I guess it's safe to say that Objective-C / XCode is really unforgiving to newbies and beginners.
 
What resources are you using to help you in your quest?

IMHO I think you may want to separate learning Objective C from learning Cocoa. Start with console apps like those in Kochan's book.

B
 
Last edited:
You are not alone, keep at it.

I guess it's safe to say that Objective-C / XCode is really unforgiving to newbies and beginners.

All programming is unforgiving to newbies and beginners - if you don't tell the computer EXACTLY what you want it to do in the EXACT syntax and EXACT format it needs, nothing good happens.

You're actually starting at a disadvantage compared to a newbie as you have to unlearn your habits and assumptions. The same thing would happen to an Objective-C/Cocoa programmer who moved over to Windows.

My advice? Decide if you want to program for the Mac or iOS. Then google the appropriate tutorial or buy a book and step through their Hello World example.

Above all, relax. You will get frustrated, but the important question is how you will react to that frustration - is it motivation to try again, or motivation to quit?

Books: Cocoa Programming for the Mac OS X (Hillgrass) or iPhone SDK Development (Dudney, Adamson).

Here are the possible sources of your frustration:
1. Operating system: Windows vs. Mac OS (or iOS).
2. Development environment: whatever you're using vs. Xcode/Interface Builder.
3. Interactions with the OS (API): Windows Foundation Classes (?) vs. Cocoa (or CocoaTouch).
4. Programming language: whatever you're using (Visual Basic? C? C++?) vs. Objective-C.
5. Programming paradigm: procedural (if that's what you're doing) vs. object oriented.

That's a lot to change in one go.

Good luck, keep asking questions!
 
What resources are you using to help you in your quest?

IMHO I think you may want to separate learning Objective C from learning Cocoa. Start with console apps like those in Kochan's book.

B
I'm looking at the documentation and also I'm trying to look at tutorials but so far when I search for Objective C or XCode, all Google throws at me are iOS development related things. The popularity of iOS app development makes it difficult to look for tutorials in developing just OS X apps.


You're actually starting at a disadvantage compared to a newbie as you have to unlearn your habits and assumptions.
Yeah that's what I figured. Things are absolutely (well not 100%) different from the way things are done on Windows.

My advice? Decide if you want to program for the Mac or iOS. Then google the appropriate tutorial or buy a book and step through their Hello World example.
I'm currently (for now) aiming for Mac OS X apps but as I have told balamw above, the OS X development tutorials are being overshadowed by iOS development mainly because it's the one popular right now and because it uses the same language / IDE.

Above all, relax. You will get frustrated, but the important question is how you will react to that frustration - is it motivation to try again, or motivation to quit?
I think all I need for motivation is just to begin to see the core structure with building the apps. As of currently I can't really grasp the way where I have to drag arrows to connect them and all that. And also some other things.

Books: Cocoa Programming for the Mac OS X (Hillgrass)
Is this what you were referring to? http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619 I assume yes.

Here are the possible sources of your frustration:
1. Operating system: Windows vs. Mac OS
2. Development environment: whatever you're using vs. Xcode/Interface Builder.
3. Interactions with the OS (API): Windows Foundation Classes (?) vs. Cocoa (or CocoaTouch).
4. Programming language: whatever you're using (Visual Basic? C? C++?) vs. Objective-C.
5. Programming paradigm: procedural (if that's what you're doing) vs. object oriented.
I've had my share of OOP with Flex (Adobe AIR). I think that's one of the IDEs I can use to compare with XCode. If you've used Flash Builder / Flex Builder, you can probably see how it's different from the way things are on XCode / Obj-C. I guess I'm more used to programming like how it's done in Flash Builder that's why I'm having a hard time with this one.

That's a lot to change in one go.

Good luck, keep asking questions!
I know right? And thanks a lot man. :)
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
IMHO, Stevenson's book from OReilly would be ideal for you, if you were running Xcode 3. He starts by making apps that don't require any code at all. It wouldn't scale to Xcode 4 well though. http://cocoabook.com

You might be able o make do with Hillegass directly, but Kochan or "Learn Objective C on the Mac" would give you a stepping stone to Obj-Cand the MVC model beforre delving into Cocoa. (note:hillegass is about to be to be updated for xcode 4, so wait to buy it).

B
 
IMHO I think you may want to separate learning Objective C from learning Cocoa. Start with console apps like those in Kochan's book.

There are also a number of computer games amenable to console I/O. Program the game itself separate from the console I/O, and the game engine then becomes amenable to a GUI. Cocoa isn't just the GUI classes; it's all the Foundation classes, too.

For example:
http://en.wikipedia.org/wiki/BASIC_Computer_Games

See the AtariArchives.org link in External Links.

Some of the games even have their own articles: Chomp, Hexapawn, etc.
 
Program the game itself separate from the console I/O, and the game engine then becomes amenable to a GUI.

Structuring your project using MVC makes this so much easier.Since the model stays the same, you just have to update your View and Controller for a change in UI, including porting from Cocoa -> Cocoa Touch or vice versa.

B
 
Welcome

I'm currently (for now) aiming for Mac OS X apps but as I have told balamw above, the OS X development tutorials are being overshadowed by iOS development mainly because it's the one popular right now and because it uses the same language / IDE.

They both (OS X and iOS) use Objective-C, but OS X uses Cocoa and iOS uses CocoaTouch. That may help narrow the search.

I think all I need for motivation is just to begin to see the core structure with building the apps. As of currently I can't really grasp the way where I have to drag arrows to connect them and all that. And also some other things.

Cocoa (and CocoaTouch) has a "run loop" that actually controls everything. It's the invisible part of the program that is what is actually calling your methods. There are thousands of methods that the run loop is calling, if they're not there it doesn't do anything, if you know the secret method name it will (seemingly magically) get called.



Yes. I notice others are recommending you focus on Objective-C first via the console and delay taking on Xcode and IB. The advantage of doing all at once is you can see quickly a program that looks like other Mac programs. Your call.


I've had my share of OOP with Flex (Adobe AIR). I think that's one of the IDEs I can use to compare with XCode. If you've used Flash Builder / Flex Builder, you can probably see how it's different from the way things are on XCode / Obj-C. I guess I'm more used to programming like how it's done in Flash Builder that's why I'm having a hard time with this one.


I know right? And thanks a lot man. :)

I'm not familiar with Flex Builder, Flash Builder so I can't comment.

As an aside, Cocoa and CocoaTouch are built on NextStep, the company Steve created between Apple tour 1 and Apple tour 2. You can still see many NextStep things in Cocoa, for example many of the classes start with "NS" (NSString, NSObject, NSWindow, and many more)>
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
Developer Library starting point:
http://developer.apple.com/library/mac/navigation/

There is a "Getting Started" button. You should at least read the things listed there.

I also recommend using the Sample Code projects, which are typically linked to from a class reference doc (such as the class reference for NSArray), or one of the other docs (such as one of the topic Programming Guides).

The reason for using and building Sample Code projects is that they are known to work. When you start from nothing, you have to know how to build things starting from nothing. When you start from an existing project, you can see the parts already built, and look at the relationships without having to build those relationships. You can also modify it and change things, including breaking things. Then you learn how to use the debugger.

Starting from nothing is like trying to build an automobile factory starting with a shovel and a book of matches. You first have to find the iron ore (go prospecting for that), mine the ore (build more shovels for that), smelt it (build a steel furnace for that), roll it (build a rolling mill for that), ship it (build a railroad for that), before you can even think about turning ingots of steel into engines and body panels.
 
There are nice tutorials on mac research, the guy behind them have also written a book that looks like it could be an alternative or complement to Cocoa Programming on OS X. I haven't read it however, but looking at the TOC, the structure is appealing.

http://www.macresearch.org/cocoa_for_scientists

Also very nice OpenCL tutorials there if anyone is interested.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.