Hello, world!

I found the Xcode development tools installer a couple of days ago. What a neat idea—include a complete IDE and full documentation about developing for an operating system with the operating system. (Are you listening, Microsoft?) Being an emacs fan, this might take a bit of getting used to, but I'm prepared to give it a try. Especially given the tome of documentation supplied.

Anyway, I did what any good Unix Wiener would do: I timed how long it took to bring up "Hello, World!" Selecting New Java Swing Application, I was presented with a few files of skeleton code. Of course, there's no minimum standard for writing "Hello, World!"—any old code will do. So I compiled and ran the skeleton code, and noticed it brought up a small window with a message in it. Easy—find that message in the source and substitute my own. Except, it wasn't easy to find. But I learned my first Apple programming paradigm in doing so: we store text in "Strings Files" for localisation.
Any text strings in your project that may be displayed to users should be localized. To do this, you place them in strings files, providing one localized variant for each language you support. A strings file, which has the extension strings, stores a series of keys and values, where the values are the strings and the keys uniquely identify the strings. Xcode supports localization with strings files by providing options to make a file localizable and to add files for local variants.
Neat. Hardly earth shattering, but you'd have to admit that sounds like the Right Way to do things. So I did my trivial string substitution (yes, feeling like a fraud), and had "Hello, World!" up on the PowerBook in seven minutes. Even better, Xcode just told me there's updated documentation available, so it's downloading all 200M of it right now.


  1. My God... that Java Swing application start up glue code is horrible! I would say more, except I don't know any Java. That qualifies me to say that the reason I don't know any Java is because it's horrible!

    Which is why I'm inordinately pleased that Cocoa is written in Objective C rather than Java or C++!

  2. I know Java, and that skeleton code was horrible. But then, I've never built a large GUI, so maybe it was just right for that. Or not.

    So, Objective C, eh? What's that all about?

  3. file:///Developer/ADC%20Reference%20Library/documentation/Cocoa/Conceptual/ObjectiveC/index.html



Post a Comment

Popular Posts