Re: *Really* Understanding Cocoa
Re: *Really* Understanding Cocoa
- Subject: Re: *Really* Understanding Cocoa
- From: Dustin Voss <email@hidden>
- Date: Thu, 26 Dec 2002 04:48:22 -0800
On Wednesday, December 25, 2002, at 02:48 PM, Udo Ludtke wrote:
Hi There,
I have been getting into cocoa using "Learning Cocoa", Garfinkel's
Building
Cocoa Applications", Hillegass' "Cocoa programming for Mac OS X"
books, and
Beam's examples on the O'Reilly Network and the examples at
stepwise.com on
the Web.
I can make the examples work, but I still do not have a proper grasp
how
Cocoa works.
When I learned C, most of the books explained the C language in terms
of
hardware, that is, in locations in memory. I may be biased because I
started
from a hardware background, but these explanations made perfectly
sense to
me, even though they were oversimplified.
I have never seen a complete explanation of Cocoa in those terms--I
have
seen bits an pieces of it here and there. Basic Cocoa terms are seldom
explained by reducing them to a lower level. That Cocoa uses a totally
new
terminology, does not help either. I am looking for an explanation that
would go as follows: (The example below is probably wrong, but
hopefully it
will get the idea across.)
snipped
Has anybody done such a series of Cocoa explanations in one place?
Maybe I should try to write them up, and then I would understand Cocoa
;-).
Yeah, that would help you understand it. They say the best way to learn
something is to teach it, and my experience bears that out.
Outlets are just variables in a struct. All Objective C objects are
structs. Objective C is basically a pre-processor that changes text
like [self alloc] to a C function call. Granted, it's a fairly
sophisticated pre-processorit's almost a compiler in its own rightbut
that's how I think of it. Just know that it all boils down to C in the
end. If you want more details along those lines, you can read "The
Objective-C Programming Language" manual on Apple's site, especially
the "Objective-C Runtime Functions and Data Structures" chapter
(
http://developer.apple.com/techpubs/macosx/Cocoa/ObjectiveC/
9objc_runtime_reference/Objective_C__Structures.html).
I haven't found a good low-level description of how NIBs, outlets, and
actions work either, but I managed to come up with a mental model to
help me out. After doing that, of course, I discovered
www.cocoadev.com. Among the pages on that site are some that explain
how some things work. I contributed to the page titled "FilesOwner";
another useful page for you might be "OutletVariable". Their URLs are
"
http://www.cocoadev.com/index.pl?<page title>", or do a search.
Actions are simply callbacks provided by a class, taking one parameter.
"IBAction" and "IBOutlet" are simply bits of text that IB can
recognize; they're probably empty #defines or something.
I don't know much about it, but key-value coding might also be useful
for you to understand. Look up the NSKeyValueCoding protocol, and check
out this list's archive. It's evidently more powerful, and used in more
places, than the docs let on.
Hope this helps.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.