Hacker News new | ask | show | jobs
by famfam 5827 days ago
Didn't see a single explanation of why the language deserves my love. Let's see.

* The language is verbose.

* Practically speaking, it's only used to developer for two platforms (OSX and iOS).

* The frameworks for those platforms are MEGA verbose.

* The memory management model for the iOS platform is not GC, and it's not manual management. Frankly I found manual management of memory simpler than retain/release. And the autorelease pool? That's just wrong.

* Typically speaking back to two files per class.

* Doesn't have any functional elements to it whatsoever. Any manipulation of collections = instant development velocity kill.

* Typically have to deal with two different kind of strings (NS versus C).

So for now, yep, I still hate ObjectiveC.

3 comments

I agree with all your points but this one:

The memory management model for the iOS platform is not GC, and it's not manual management. Frankly I found manual management of memory simpler than retain/release. And the autorelease pool? That's just wrong.

retain/release + autorelease pools solve the ownership problem inherent in manual memory management system. You can return a heap allocated object from your function/method and neither you nor the caller have to be concerned about how it will be cleaned up.

Not sure what's wrong with that solution -- I've even implemented/used an equivalent implementation for pure C code.

"Doesn't have any functional elements to it whatsoever."

There are methods like makeObjectsPerformSelector: and now methods for taking blocks.

Sending a selector is not functional, true, because it is an OO language, not a functional one. So the idea is "send this message to all these objects" instead of "call this function on all these objects."

Unfortunately, I don't see anyway to create a new collection from an existing one by sending each object a message (the equivalent of map). Furthermore, some methods actually do take C functions, and others take an NSPredicate. It would be more consistent if they had found a way to do all these things by sending selectors and a varargs list.

(It seems like blocks is the new, improved way to do all these things, and rather functional, but all the older ways still exist, so a developer must understand all of them.)

Are blocks available in the iOS version of Objective-C? (Not trying to refute your point, just curious, since that would be exciting news for me if I do another iPhone app...
They're available in iOS4 natively, or can be used with earlier OSs with this project: http://code.google.com/p/plblocks/
> Typically have to deal with two different kind of strings (NS versus C).

NSString has plenty of methods to deal with this, and you get boxing for free between CFString and NSString.

> The frameworks for those platforms are MEGA verbose.

Which some view as self documenting.

NSString has plenty of methods to deal with this, and you get boxing for free between CFString and NSString.

And that pesky char * that you get from C.

Hah, okay, make it 3 then. I was only thinking of NSString and char*.