Swaine Manor: The Object of Our Affliction
Volume Number: 26
Issue Number: 07
Column Tag: Swaine Manor
Swaine Manor: The Object of Our Affliction
A few facts and non-facts
about Objective-C
by Michael Swaine
Objective-C
As the center of the software development universe shifts from computers to mobile devices, many problems and challenges thought to be solved are with us again. As this new/old thing called iOS becomes the center of Apple's software universe, the problem list includes Objective-C. It's the preferred language of iOS app development, inherited from NEXTSTEP along with the NeXT operating system that became Mac OS X and the exile who became the CEO, now woven throughout the fabric of Apple's i-space like some fungal mycelium. Since most of the apps you use will soon be Objective-C-based, I thought I'd share with you a few little-known facts about the preferred language of iPhone development.
Did you know, for example, that its inventor doesn't use it any more? Brad Cox has moved on to XML, Java, Ruby, Python, and Perl (http://virtual-school.edu/cox/).
Did you know that Java was modeled after Objective-C? One of the creators of Java says so (http://web.archive.org/web/20071030010852/http://www.cs.umd.edu/users/seanl/stuff/java-objc.html).
Did you know that the Cocoa framework of 2002 was nearly identical to the NEXTSTEP APIs of 1992? (http://www.linuxjournal.com/article/6009) Let's call that consistency, because it sounds so much nicer than stagnation.
Memes
But what really matters are the memes and jokes. One of the classic memes is, "If Xs were Ys, what kind of y would x be?" Like, "If programming languages were beers, what kind of beer would be language Y be?" OK, so if programming languages were beers, what beer would Objective-C be? The Internet provides an answer (http://lambda-the-ultimate.org/node/3133), as it does is to every question so long as you don't care about the quality of the answer. If Objective-C were a beer, it would be Pabst Blue Ribbon. I have no idea why.
There is an Objective-C version of the Shooting Yourself in the Foot joke (http://burks.bton.ac.uk/burks/language/shoot.htm). You know: "In C, you shoot yourself in the foot. In Concurrent Euclid, you shoot yourself in somebody else's foot. In Pascal, the compiler won't let you shoot yourself in the foot. In Java, you shoot yourself in the foot and everyone else who accesses your website leaves hobbling and cursing. In Forth, you yourself foot in shoot...." The Objective-C version? "In Objective C, you write a protocol for shooting yourself in the foot so that all people can get shot in their feet." You see the influence on Java, right?
Jozef Dransfield has posted an Objective C Joke of the Day. Apparently just one. Here it is: "Why do they need a garbage collector in Yorkshire? Because they keep calling 'init'!" I can see why the tradition only lasted one day.
There are Objective C versions of the "...is the new..." meme (http://en.wikipedia.org/wiki/The_new_black). You know, "Pink is the new black," "Random is the new order (Apple)," "Black is the new President (Tracy Morgan)." Technically, this is a snowclone (http://en.wiki-pedia.org/wiki/Snowclone). A search on "Objective-C is the new..." yields:
Objective-C is the new Java
Objective-C is the new Ruby on Rails
Objective-C is the new HTML
I dutifully report these results, but I don't think any of these people know what "is the new" means.
But I keed. Objective-C is actually a pretty cool language, if a little old, inspired by an even cooler (and older) language, Smalltalk. Anyway, because you always want to leave 'em with something to hum on the way home, there an official Objective-C country song ("Retain My Heart/Or you might point to an invalid memory reference..."), inspired by the inimitable Erica Sadun. Follow the link (http://www.tuaw.com/2010/05/21/rocking-the-objective-c-ountry/) to the audio and sing along.
All together now.
Michael Swaine is the former editor-in-chief of Dr. Dobb's Journal (http://www.ddj.com) and current editor of PragPub (http://
www.pragprog.com/magazine), the electronic magazine for pragmatic programmers. You can reach him at mike@swaine.com.