7.30.2008

Mac Application Development, Initial Review

I'm about 30 days or so into what I'd consider the "exploratory" phase of learning the Mac OS X programming system, and I have to say it has been quite interesting so far. I'm far from any sort of in-depth understanding of Mac's wide range of core technologies, but with a fairly solid background in C++ as well as a variety of UI-heavy systems like Flash and Flex it was surely easier than it could have been. Even despite all of that, the learning curve in certain areas is unexpectedly steep (and not always necessarily so, from everything I can figure).

First and foremost, the documentation leaves a lot to be desired. One might say, in fact, that it downright sucks. That's not to say that it doesn't define every method and property, but its definitions are rarely more than a brief, enigmatic sentence, and (more importantly) there literally isn't a single example in any of the class documentation. I, as most developers I know, am a 95% learn-by-example kinda guy, which has made the going slow. Incidentally I've even been a bit hard-pressed to find good examples via other sources online, which is probably the most surprising part. Admittedly I've been spoiled from years of web development, but I've definitely gotten used to being able to find examples of even the most obscure sub-class out there in some forum or another. Cocoa development doesn't seem to operate quite the same, however - there are plenty of simple examples but I haven't found more than a handful of advanced code snippets, particularly regarding the UI components. It suffices to say that I have been hammering through these early days on a heavily trial and error basis.

XCode itself, Apple's project development environment, seems to be very well put together. The user interface was extremely intuitive for me from the start, and you really can crank out an app in no time at all without having any prior experience. That is of course to be expected (being an Apple product), as is the solid and simple functionality of the Interface Builder. XCode/ has some similarities in structure to many other recent coding environments such as Eclipse (and thus Flex) and MS Visual Studio, which I'm sure adds to it's accessibility, but I'd have to say overall it's one of the best coding environments I've worked with to date.

And then there's the code itself. I'm pretty torn on first impressions towards Objective-C. In a nutshell it's an object-oriented offshoot of ANSI C, but shooting off in a different direction entirely from C++. That means that it has more in common with C than C++, and has a radically different syntax for about half of anything you may want to do in standard ANSI C. It's definitely simpler than C++, which is a plus most of the time. There are, however, some really weird syntax differences between Objective-C and pretty much anything else I've ever worked with before. I've worked in over a dozen different programming languages over the past decade and a half, and I have never seen anything like this:

[txtOutput setDoubleValue:[numComponent doubleValue]];

That's not to say that there's anything wrong with that, just that it is initially a bit of a maze to decipher what should be a simple line of code. Ok, I take that back - there are a couple of things wrong with it, primarily just that: deciphering it. I don't see any advantage to breaking the left-to-right reading object-method/property system that is used in nearly every other programming language. I am, admittedly, pretty green in this area, and may soon stumble across some hidden advantages yet. In reality, though, I probably won't even notice it after a couple of months (just like every language's quirks).

Lastly, the wide array of built in functionality is truly unbelievable. For example I threw together a quick test app that interacts with (retrieves, updates, the works) a user's iCal in just a few hours, and that's really just the very tip of the iceberg. The frameworks are very well put together and generally speaking (aside from that whole documentation bit) quite easy to use.

All in all, I'm going to reserve judgment for another couple of months of experience, but I'm definitely hooked. I'm generally not as interested in desktop development as I am web development, but there really are some pretty exciting possibilities here that I can't pass up.

Back to work...