I would recommend use of Objective-C without Apple frameworks to anyone who must build robust modular systems while retaining C compatibility or performance characteristics. I use it myself in a game engine.
Stop the Hate: Obj-C Deserves Your Love
11–20 of 91 posts
Re: Stop the Hate: Obj-C Deserves Your Love
#12Here are some reasons I think Objective-C needs to be retired:
- Header Files: These are archaic and require you to repeat code unnecessarily. Compiler's shouldn't require humans to do something that computers are better at.
- No Automatic Garbage Collection: In ObjC 2.0 we have this, but not on the iPhone. Unless you are making a high performance game, there is no reason the phone can't handle Automatic GC.
- No NSDictionary/NSArray literals: [[NSDictionary alloc] initWithObjectsAndKeys:@"value", @"key", @"value2", @"key2", nil]; // Enough said
- No regex: You kind of get regex's in 3.2+, but they are very limited and require around 3-4 lines of setup to get anything done.
- Xcode: You are pretty much required to use Xcode and I don't like Xcode. Even if you use the "xcodebuild" CLI, you still have to create the project through Xcode.
- Closures: I guess we will be able to use these soon, but it is going to take awhile for all the API's to get updated to accommodate them.
- No dynamic variables: It's handy to be able to shove data into objects sometimes. It's a hack, but as long as you treat it as such you can save a lot of needless code. (You can do this via the ObjC runtime, but it's messy)
- Unit Testing: It barely exists and is difficult to use.
- No namespacing: ObjC handles namespaces by prefixing class names. Blah, that is so 1978.
Re: Stop the Hate: Obj-C Deserves Your Love
#13It really is sad that so little of the state of the art in GC is available in mainstream languages.
Re: Stop the Hate: Obj-C Deserves Your Love
#14Erm, not true. For example, NSString's
+ (id)stringWithFormat:(NSString *)format, ...Re: Stop the Hate: Obj-C Deserves Your Love
#15I don't understood why people think automatic deallocation = garbage collection = slow language. You can have reference counting without garbage collection. It's pretty obvious to a compiler when a variable has gone out of scope and can be dereferenced (and deallocated immediately at 0). Using a language like obj-c where you have to do memory management manually just seems so archaic after using modern languages. Plu…
The "property duplication syntax" (I assume you mean the declare versus synthesis) is there for flexibility and so you can do some pretty good customization to make your classes work better.
For OS X, Objective-C now has garbage collection that works pretty well.
Re: Stop the Hate: Obj-C Deserves Your Love
#16* 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.
Re: Stop the Hate: Obj-C Deserves Your Love
#17He is at the first stage of Cocoa development. Learning a new language is fun, and you can create some really cool stuff with the Cocoa frameworks. But once that wears off you are left with Objective-C, a vestigial language that isn't suited for a majority of application development. Here are some reasons I think Objective-C needs to be retired: - Header Files: These are archaic and require you to repeat code unneces…
I just wish I could use it for iPhone development. :)
Re: Stop the Hate: Obj-C Deserves Your Love
#18I don't understood why people think automatic deallocation = garbage collection = slow language. You can have reference counting without garbage collection. It's pretty obvious to a compiler when a variable has gone out of scope and can be dereferenced (and deallocated immediately at 0). Using a language like obj-c where you have to do memory management manually just seems so archaic after using modern languages. Plu…
That's not an Objective C thing, the language has garbage collection, just it isn't enabled for the mobile platform, for the reason it eats power and memory.
Re: Stop the Hate: Obj-C Deserves Your Love
#19He is at the first stage of Cocoa development. Learning a new language is fun, and you can create some really cool stuff with the Cocoa frameworks. But once that wears off you are left with Objective-C, a vestigial language that isn't suited for a majority of application development. Here are some reasons I think Objective-C needs to be retired: - Header Files: These are archaic and require you to repeat code unneces…
Compared to other C-supersets, it's not the worst thing ever, but yeah I totally agree with you that Obj-C is painful compared to many newer languages. So glad that MacRuby is pretty much usable now. I just wish I could use it for iPhone development. :)
Re: Stop the Hate: Obj-C Deserves Your Love
#20I don't understood why people think automatic deallocation = garbage collection = slow language. You can have reference counting without garbage collection. It's pretty obvious to a compiler when a variable has gone out of scope and can be dereferenced (and deallocated immediately at 0). Using a language like obj-c where you have to do memory management manually just seems so archaic after using modern languages. Plu…
`[object performSelector:sel];` // where `sel` may be - retain
How should the compiler optimize that?Plus there is strange property duplication syntax
You don't have to bother with that anymore. The only reason you ever did with iPhone dev is because the iPhone Simulator didn't support the modern runtime. If you only tested on the device, you never had to bother with it.
As of LLVM 1.5 (in Xcode 3.2.3) or 2.0 (in 4.0) on 10.6, the compiler can fake enough for runtime support (and only requires @property declarations - no more ivar or @synthesizers): http://www.mcubedsw.com/blog/index.php/site/comments/new_obj...
named parameters
Objective-C doesn't have named parameters. It intertwines the method names with the arguments that it takes.
Instead of `void doStuff(foo, bar, baz);`, its `- (void) doStuffFoo:(id) foo bar:(id) bar baz:(id) baz;` (which can also be written (and compiled) as: `- (void) :foo:bar:baz;` if you wanted).