random($foo)

On Application Development #

random($foo) is the personal site of Leonard Lin, where I collect shiny things and publish original writing and code. more »

The other day, Jeff Atwood posted a piece entitled A Scripter at Heart that distinguished programming vs scripting. Simon Willison had a strong (negative) reaction to that, and proposed distinguishing by the term “dynamic languages”. Yesterday Matt Biddulph posted a bit about some of his experiences as a web developer working with Objective-C and the iPhone (some more discussion), and since I’ve been doing something similar this month, I thought I’d throw in my 2-cents (my experience so far has differed from Matt’s), since it also relates to how I veiw the divide of two very different types of programming (systems vs application?).

To preface, like Matt, my background is also primarily as a web developer, although not exclusively – I’ve written my share of Lingo, Java Applets, OpenGL, Shake scripting, Max/MSP and Processing and other stuff. These days I hang my “expertise” hat on web architecture and systems, but I’ve done a fair amount of just about everything on the web side of things including some lower level things like working on Apache modules.

This isn’t to brag (you’ll note no accomplishments of merit mentioned above :), but simply to give some context of where I’m coming from. Learning Cocoa has been interesting. Of course, first and foremost, there’s the unique feeling of being a newbie again – that awful confusion, but also the excitement and then that somewhat retroactively forgetful feeling of incomprehension at not understanding how something works…

This learning phase may have maybe been more painful that it could or should have been. “Learning Cocoa” encompasses, not just a language (Objective-C) tied intimately to multiple very large sets of libraries (collectively Cocoa, but also CoreFoundation, AppKit, and in my case Quartz, Core Image and CoreAnimation as well as an inscrutable third party API), but also XCode and Interface Builder, each with a myriad number of settings, plists, etc.

While I think that a further discussion of the total lack of context and the bits and pieces of documentation/tutorials that did help me get my bearings may be the topic of another post, I did want to mention that the Apple Developer Documentation did not help me as I would have hoped in terms of orientating myself.

Some more observations:

  • It’s sort amazing how much more work seems to go into accomplishing very little, and how your ambitions scale along with that. I’ve spent more time working on looping some animations and making sure it doesn’t leak memory for example than say the Event SRP, or heck, the entire offline-task system on MyBO. Maybe it’s just my experience so far (biased say with spending a solid week fighting a certain third party SDK while learning the fundamentals), but I can see now why desktop apps haven’t seem to evolved as quickly as web services have. There’s just a lot of slog involved.
  • Note: PyObjc doesn’t make things easier – it’s just … hideous
  • Although… it would avoid Objective-C 2.0’s ridiculous memory handling – there’s garbage collection on the RunLoop, but only in some cases (for explicitly init’d, alloc’d and retain’d objects) but the AutoRelease doesn’t happen in threads, which by the way NSTimer launches, so make some subpools, but be sure not to over-CFRelease lest you cause an ecxeption (and crash) down the line, but good luck w/ MallocDebug if you missed anything and need to track it down… Don’t I have better things to do with my brain cells?
  • Casting through contexts is just out of control. NSImage, CGImage, and CIImage? Really?
  • Get used to writing at least 10 LoC to do what seemingly should be a single easy action (or declaring something in at least two if not more files and sections). Coming from scripting languages, the amount of boiler plate is mind boggling
  • Also, as someone used to CPAN, PEAR, and PyPI, it’s also been interesting discovering how spoiled by the ease of third party libraries and how much less common and more effort it takes. Maybe I just haven’t gotten quite that far yet…
As a web developer, I’ve often complained about the crudity and lack of development and debugging tools, but having dipped my toe on the flip, I guess it’s tough all around. Application development seems to be dense, convoluted and, well, sometimes just plain masochistic.
It’s also interesting that for as many (and there are many) calls there are in the standard Frameworks, how equivalently difficult it seems to be to do anything that you *want* to do (this will be another near-future post where I talk at length about the current state of web “frameworks”).
But, who knows, maybe in a few months I’ll at this post and shake my head and wonder how I could ever be so confused.

Tags: ,

  • uvince

    Woah! Matt's crazy for the stuff: “I’ve found Objective C to be a surprisingly pleasant language, and Cocoa is one of the best frameworks I’ve ever worked with”

  • http://simonwillison.net/ Simon Willison

    Just to clarify, the only statement that really upsets me is “that's a scripting language, not a programming language”. Scripting languages are clearly a subset of programming languages. I'm OK with the use of the term scripting language provided it isn't used to make a comparison with “programming languages”. I do however think dynamic language is a more useful classification.

  • http://randomfoo.net/ lhl

    Yeah, horses for courses I guess.

    I've found Objective-C to be annoying to infuriatingly, and Cocoa to be crufty and at times, just plain hateful. Casting between NS and CF contexts, the performance penalties for using getters so that you need to create local pointers for everything, the mess w/ NSStrings and annoyances w/ simple things like equality, switches and concatenation, all the context switches and then the mishmash of NS and CF stuff, sleeps and delays causing animations not to be thrown, etc. etc.

    The application I've been working on is conceptually trivial, but it's been a slog plowing through it – I guess I just don't think in the right way.

  • http://randomfoo.net/ lhl

    For me, the issue seems to be that though he starts (red-herring like talking?) about scripting and programming “languages,” (and yes, it's wrong-headed), and then goes on to describe the difference in how he views the *activities* of “scripting” and “programming”… which I suppose is also nonsensical and doesn't parse in a “you keep using that word. I do not think it means what you think it means” type of way (and it certainly has stirred up the languagenistas in the comments).

    That being said, I don't think Atwood's trolling, but the vocabulary for describing that distinction just isn't there. I think to some degree, what he's talking about really revolves around a person's difficulty of accomplishing a desired task *relative* to one's understanding of the context. I think a lot of the discussion gets tied up because it tries to draw a fixed binary division across a gap that's wholly dependent on personal experience and domain-specific goals.

  • http://topfivesextoys.com sex toys

    thanks!

  • itjob123

    I think to some degree, what he's talking about really revolves around a person's difficulty of accomplishing a desired task *relative* to one's understanding of the context. I think a lot of the discussion gets tied up because it tries to draw a fixed binary division across a gap that's wholly dependent on personal experience and domain-specific goals.

    http://staffingpower.com/