Re: NSTextView
Re: NSTextView
- Subject: Re: NSTextView
- From: John Hörnkvist <email@hidden>
- Date: Sun, 26 Aug 2001 13:57:31 +0200
On Sunday, August 26, 2001, at 12:57 PM, Markus Hitter wrote:
for a beginner, I think, it's as a normal state of affairs, that you
have to take more than 90% of your "coding" time lurking trough all the
Docs and Code Examples. I sometimes end up myself having written only
ten lines of code the whole day, but these ten lines do often lots more
than 200 lines in plain C.
Cocoa is something very elegant, but it takes some time until you get
the idea behind it and start to think solving problems the Cocoa way.
Patience is the key to make it.
I agree.
I think it's rather amusing that Foundation actually seems to make
learning harder. Back when I started, on NextStep, and before
Foundation, knowing C helped a lot, because arrays where usually handled
with pointers, there was no retain/release/autorelease to learn, and so
forth.
Because of that, it was probably easier to get started --- once you had
InterfaceBuilder figured out --- and to turn out a few kilo-lines of
really bad Objective-C code. :)
These days, you need to understand more to get going. There are more
classes, and some of the really nice search tools we used to have are
gone. HeaderViewer and DigitalLibrarian really helped me get started.
Using "find /System/Library/Frameworks -name "*.h" -exec grep display
{} \; -print | xargs open" just isn't as friendly.
The upside is that once you have understood Foundation, most things are
a lot easier than they were in the old days.
To anyone starting out:
Try to understand the purpose of every Cocoa class. Don't learn the API
by heart, but try to get a grasp of what the classes can do.
Start with foundation, and build something like this:
Collections:
NSArray: Store objects in an ordered fashion.
NSSet: Store objects without order.
NSDictionary: Store objects by name.
Capsules:
NSString: Text/String support
NSColor: Color (!)
NSData: Generic data
...
Tools:
NSEnumerator: iterate over collections
NSScanner: Search through/Process/lex text
NSCoder: Serialize objects
...
When you can quickly associate between a problem (eg need to load text)
and a class that is likely to help you (NSString), programming with
Cocoa will be much easier. It's not difficult to learn, you just have to
commit yourself to doing it.
Working through tutorials can be fun, but I don't think it will help
very much; usually you get too myopic. A ring binder, printed Cocoa
documentation and a pad of Post-It notes was my tool for the job.
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com