Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Cocoa learning curve?

Cocoa learning curve?
Thread Tools
Mac Elite
Join Date: Oct 1999
Location: New York, NY
Status: Offline
Reply With Quote
Apr 14, 2003, 10:30 PM
 
I've been trying to learn Cocoa on and off for a few weeks now and maybe I'm just impatient because I'm getting really frustrated. I'm fluent in C++/JavaScript and did RealBasic for a long time so I feel as if I know something about OOP. Cocoa is confusing the heck out of me though! I'm new to Obj-C so the structure seems a bit backwards, with all the *s and @s and the way of calling methods just seems all mixed up. And how you have to introduce nibs to all your objects and....

And Project Builder. It hates me. I tried to save a document.h and it claimed it was in the trash. And NSLog isn't outputting anything in the debugger for me.

*sigh*

I need some motivation to keep learning this language... it's driving me nuts so far... is it worth the trouble?? Any tips? Does it get easier??? ahhh... ranting...
     
Forum Regular
Join Date: Aug 2000
Location: UK
Status: Offline
Reply With Quote
Apr 15, 2003, 04:49 AM
 
I would keep trying. Almost everyone starts declaring Cocoa as the best thing since sliced bread once they get used to it.

I find the syntax very natural - it's a lot easier to read function/message calls that use a lot of different arguments. As for NSLog not outputting anything to the debugger - that would suggest NSLog is not being called at all.

I'll bet some time soon you'll have a moment of clarity and everything will magically make sense. Cocoa is pretty simple once you've got the basic concepts sorted out - I found the learning curve to be quite gentle.
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
Apr 15, 2003, 11:24 AM
 
I would suggest you get the Hillgrass book. It is very informative yet goes quickly. It will give you a good feel for how things work with Cocoa. The other available books on Cocoa programming are also good. I recommend the Hillgrass book since I think it does a great job of explaining how to use Cocoa. Btw, I have all the books except the new Vermont Recipe book by Cheeseman (I will be getting it though). I have found that the books tend to complement each other.

Regarding your C++, although I do not know C++ (can only read it), it seems that C++ coders have the most difficult time making the transition (something to do with the static nature). This view only comes from observing the cocoa developers list hosted by Apple. You can go over to http://cocoa.mamasam.com to see all the messages posted to the list. The C++ implementation of OOP is different from the Objective-C and Java implementations (Java and ObjC share alot in this area).
     
Forum Regular
Join Date: May 2001
Location: Oviedo, Floriduh USA
Status: Offline
Reply With Quote
Apr 15, 2003, 03:23 PM
 
Cocoa and Objective-C are worth learning. The Hillegass book is very good with step-by-step examples.

It took me a while to become accustomed to Objective-C because it's so much like Smalltalk in a C body but it is quite nice. C++ is very usuable, coming from a C background, but you'll find that there are so many things tacked on, that it's no wonder C++ is called a hybrid language.

It's more likely that people coming from Java will be able to grasp Objective-C concepts quickly. Once you know Objective-C, using Cocoa is not much more than doing a lot of research (it rivals Java in this respect) and drawing lines. I finally came up with an outline that I follow each time I want to do an Objective-C/Cocoa project.
folding@home is good for you.
     
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Apr 16, 2003, 12:00 AM
 
You couldn't scan and post that outline, could you? I think it would help me a lot. Thanks.
     
Forum Regular
Join Date: Jul 2002
Location: Australia
Status: Offline
Reply With Quote
Apr 16, 2003, 06:54 AM
 
I think lfrog2 is right - coming from intermediate-level Java I had very few problems with Cocoa. Objective-C is the only non-Java langauge I've learnt that I feel comfortable with. Only problem is that I don't have time to do any more with it during the university semester.
     
eno
Banned
Join Date: Sep 2000
Location: Fightclub
Status: Offline
Reply With Quote
Apr 16, 2003, 07:37 AM
 
I'd give up if I were you. You're obviously going nowhere.

Stick with REALbasic and if you're lucky you'll end up on http://perversiontracker.com/ . That is, if you're not on there already...
     
Professional Poster
Join Date: Jan 2002
Location: Rochester, NY
Status: Offline
Reply With Quote
Apr 16, 2003, 11:21 AM
 
Originally posted by eno:
I'd give up if I were you. You're obviously going nowhere.

Stick with REALbasic and if you're lucky you'll end up on http://perversiontracker.com/ . That is, if you're not on there already...
Ahh, now thats such a great attitude.
     
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
Apr 16, 2003, 03:19 PM
 
Originally posted by CheesePuff:
Ahh, now thats such a great attitude.
It's not even an attitude ... that's ignorance
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
Mac Elite
Join Date: Oct 1999
Location: New York, NY
Status: Offline
Reply With Quote
Apr 16, 2003, 07:21 PM
 
Originally posted by eno:
I'd give up if I were you. You're obviously going nowhere.

Stick with REALbasic and if you're lucky you'll end up on http://perversiontracker.com/ . That is, if you're not on there already...


REALBasic sucks for OS X work. It used to be fine for OS 9, but it's a disaster now. Anyway Cocoa is going a little bit better now. But it's a lot to learn especially when I have to master Maya in 4 weeks
     
Forum Regular
Join Date: May 2001
Location: Oviedo, Floriduh USA
Status: Offline
Reply With Quote
Apr 17, 2003, 12:15 PM
 
Originally posted by Thinine:
You couldn't scan and post that outline, could you? I think it would help me a lot. Thanks.
I hope this helps.

Open Project Builder and create Cocoa Application Project

Open MainMenu.nib and design user interface using Interface Builder

Create a subclass

Click on the Classes tab
Select NSObject (or the appropriate superclass) and press Return
Name the subclass MyController (or something more appropriate)

Define an outlet

Select MyController in Classes
Select Attributes in inspector
Click Outlet tab
Choose Add Outlet and name an outlet for each text field
Add another outlet with a name based on the action such as converter

Define actions

Choose Add Action and name it for the action

Generate an instance

Select MyController in Classes
Choose Instantiate MyController from the Classes menu

Connect the class to the interface fields

Control drag from the instance to each text field
In the connections, select the outlet that corresponds to that field
Click Connect

Connect the interface controls to the class

Control drag from the button to the instance
Select target in the outlets column
Select convert in the actions column
Click Connect

Define the class to receive the action

Select NSObject and press Return
Name the subclass Converter
Instantitate the Converter class
Click Instances tab
Control drag from MyController to Converter and click connect

Generate source files

Select each custom class and choose Create Files from the Classes menu
Validate the Insert Into Targets and Click Choose

Move source files

Go to Project Builder
Select the generated source files and drag them into Classes

Add member declarations to be called from the Controller

Declare the calculation in a member in Converter.h
Implement the calculation in Converter.m

Implement action members

Add #import "Converter.h" to MyController.m
Get information from interface fields
Call conversion routine with values using outlet name, not subclass
Set interface fields with returned information

Implement the awakeFromNib method

Add a member to MyController.m based on the first text field
folding@home is good for you.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:24 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2