So I've been trying to learn a bit of Objective-C, and one question springs to mind:
What the hell is this shit?
I keep hearing people say the syntax is simple and elegant. It may be simple, but this shit sure isn't elegant. It looks like two completely different programming langauges mixed together, which is pretty much what it is. For a couple of minutes I thought the named arguments for messages were cool, but then I realize that the FIRST argument is not named anyway, and people are trying to force this into making sense by naming their functions after the arguments they take. It's just a mess.
The memory handling is utterly absurd - it sort of pretends to be garbage-collected, but has very few of the benefits of a real garbage collected system. The fact that the Apple documentation has several pages of text that tries to explain when you should and when you should not release objects is quite telling. Object creation is no better. Init? Alloc? Copy? Memory zones? Who can keep track of all this? And really, memory zones? What the hell?
ObjC is ghey. Don't you have anything better to do?
You're kind of stuck with it when writing code for Mac OS X.
Thank god for Objective-C++. Mixing in even more syntax isn't exactly elegant either, but at least I don't have to keep saying [[Class alloc] init].
[Class new]
=O. Macros might also help.
Ahem. Yes, objc is a bit verbose. well, the memory management I still find more convenient than the standard methods of C and C++, though the latter allows you to do the same.
I'd vote for a sort-of "nextgen" ObjC. Features like blocks, default arguments for functions, garbage collection and... a cleaner syntax. Kind of a compiled ruby. Yeah.
I decided to tinker with ObjC some more at some unspecified point in the future just to use Projectcenter to create GUIs.
Update! Update! Update!
After using it for a couple of months, I've gotten more used to some of the weird idiosyncracies, and I can almost balance my retains and releases now! Almost. I even sort of enjoy some of the more reckless and crazy parts of the language. On a good day, it almost reminds me of Perl.
However, I also found more utterly retarded idiocy. For instance, what is up with NSArray
and friends, and nil
? Adding nil
to an array or dictionary appears to be completely arbitarily forbidden. Having empty elements in an array is an obvious and useful feature, and forbidding it is pretty dumb.
Especially since the language adds the NSNull
object to give you a null object to add to arrays. This last parts leaves me speechless. First you forbid an arbitary action, and then you work around it. What is this, religion?
>>5
Nurupo
GA!
Today's programming trivia: Objective-C allows you to send messages (that's "call methods" to the rest of the world) to nil, meaning there are no NullPointerExceptions.
GA!
two words: http://camelbones.sourceforge.net
obj-c/perl bridge framework for cocoa.
I am having some trouble figuring out how you counted those words, there.
Also, people who say "two words:" are hopeless Slashdotters. Snap out of it!
simple. a url is not a word, so the sentence "two words: http://..../" contains two words. but you're right, I do read /. from time to time (although i've never seen anyone there use "two words:"); you win. i'll put snapping out of it at the top of my todo.