Apple may be one of the best-run companies of all time. Steve Jobs may be a personal hero. The iPhone and the iPad may be beautiful technologies. And developing apps for iOS may be a lucrative opportunity — if you’re lucky enough to win App Store approval and get discovered in the deluge. But that doesn’t mean being part of the cult is all love. One of the myriad ways that being a part of the Apple development ecosystem chafes our hides is having to program in Objective-C. (Hurry up and get here, Swift language!)
Following are 9 reasons why Objective-C has proved itself worthy of our ire.
It’s a little too different
Objective-C lovers tout that Objective-C is a strict superset of C: If you can do it in C, you should be able to do it in Objective-C. But it doesn’t go the other way, so you’re stuck wondering, “Should I use an Objective-C method description or a C one?” Achieving portability to C programs requires constant vigilance and forethought.
Plus, for all of the claims of being a proper superset, little things don’t line up. Like the suffix: C code is stored in files that end in .c; Objective-C files end with .m.
It’s still mostly just plain old C
For all its object-oriented coolness, you don’t get much else from Objective-C. It’s more of a way to organize your code for large systems than a way to write better code. You’re still responsible for pointers. You’re still responsible for keeping track of memory. The C programmers loved to call their software a “portable assembly code,” and the same is true for Objective-C … except it’s only portable from the Mac to the iPad.
Stuck in the ’80s
Parachute pants, big hair, “The Breakfast Club” — and the NeXT machine: Objective-C is like a time machine in programming-language land. The primitives aren’t first-class citizens. Garbage collection, that wonderful idea that sustained Lisp, was adopted by Java ages ago. Objective-C got it in 2006. The same goes for properties and closures. Wait. iOS never received garbage collection because no one wanted the iPhones to hiccup. Hey, at least it’s not Pascal or Ada.
The cool modern kids writing Python, Ruby, and CoffeeScript can craft billion-dollar companies without using brackets, braces, and parentheses. You’ll be wearing out your punctuation keys writing Objective-C. Colons, at-signs, asterisks? Is there any character that the language doesn’t use?
Objective-C”s syntax is like Coke: They tried to modernize it in the ’90s, but it never stuck. So you can forget about using that clean “modern” syntax that Apple tried to introduce in 1997. We’ve reverted to the “classic” syntax just like Coke Classic. It was a nice effort. It stripped out the extra punctuation and made everything a bit easier to read, if not parse. But it’s gone now to the scrap heap along with those beautiful, optimistic pavilions from the 1963 World’s Fair.
Java has them, but Objective-C doesn’t. But you can make your own by adding lots of prefixes to the front of your names. It all works out. Just don’t use the prefix “NS” because that’s Apple’s namespace. It’s another part of NeXTstep that lives on and on.
It only runs in Apple’s corner of the universe
Being stuck driving a Porsche isn’t a bad thing, but variety is the spice of life. It’s even more important in a world where not everything is an iPhone. If a Windows or Linux shop recruits you, you can forget all of those extra Objective-C extensions you learned because they’ll be of no use.
Portability is valuable. Apple (and iPhone users) are lucky that Apple’s products are so good — they’re a powerful carrot to get someone to rewrite their code in Objective-C, which isn’t terribly efficient for developers hoping to maximize their efforts across the myriad devices available to consumers.
(Note: With clever use of gcc, Cygwin, and GNUStep, you can use Objective-C elsewhere, but this is only for the strong of heart.)
Xcode is your only choice
It’s not exactly Mao’s China or Henry Ford’s Model T, but in the Objective-C world, you get really only one choice. Why do you need to be different, comrade?
To be fair, there are a few open source stacks, but it’s not like anyone uses them as often as Xcode.
Apple’s ‘benevolent dictatorship’
A benevolent dictator with a wonderful vision for its product line may not be entirely bad. After all, this particular tyrant has great taste and more class in its products than most of the rest of the field put together. But Apple is still a giant roadblock that makes life unpleasant for everyone.
Do you want to give out more than 100 copies of your iPhone app? Forget it. Do you want to “think different” with your UI? Please go back and read the user interface guidelines. You can’t do anything without Apple’s permission because Apple uses strong crypto to lock down everything — and fanatically tyrannical policies to lock down the rest.