Saturday, April 3, 2010

Learning How to Program My Mac

The interesting thing about writing Mac apps using Cocoa is that I don't really have to write much code at all to do something interesting.  Apparently it's the Mac Developer's motto.  A lot of the complexity is hidden by Interface Builder and nib/xib files.  Part of the problem for me, however, is that I am so used to writing lots of code in Java in order to do anything useful.  I don't use any Microsoft crap, so I have no access to Visual Studio, and finding a decent GUI builder like Mac's Interface Builder for creating Java SWING or SWT apps has proven to be difficult.

NetBeans has a very nice Swing GUI builder, but no matter how I try to optimize NetBeans for my Mac, tweaking stack and heap numbers, it's slower than a pig trying to swim in quicksand.  And while the performance in the latest Java 6 SE SDK is apparently remarkable, Apple is always behind when it comes to supporting Java.  It's like they wait six months or more before catching up.  True, Apple is only one revision behind, but it is very frustrating waiting.

So back to Cocoa...  Cocoa makes heavy use of the MVC pattern, and you have to understand things like bindings, outlets, actions, etc.  I keep looking at example source code, and it is confusing.  Some people do more work than is apparently necessary--I think this is older code.  And I am always trying to find a way to code something when I don't really have to.  The documentation isn't bad, but it's dense and it seems that there are so many things you have to understand first, so I am constantly going from one document to the next, or looking up API references, etc.  I try to do entirely too much at once rather than just taking my time.  No patients I guess.

The first app I was trying to make was something similar to, albeit far less complex than, OmniOutliner.  I always seem to take on too much as once.  But unless it holds some interest, I just can't be bothered.  Anyway, I will post my progress on this project.  I'd post now, but I've already trashed my last three attempts and haven't learned much in the process.

Oh yes.  One more thing.  The book "Cocoa Programming Developer's Handbook" by David Chisnall, which I have mentioned before, has been wonderful.  I can't recommend it enough.

Reblog this post [with Zemanta]

No comments:

Post a Comment