3 ms·
Objective-C, the language: it's a nice, thin object-oriented layer on top of vanilla C. It's super-easy to use to make object-oriented wrappers around vanilla-
by frig 18y ago
Objective-C, the language: it's a nice, thin object-oriented layer on top of vanilla C.
It's super-easy to use to make object-oriented wrappers around vanilla-C libraries, compared to C++, and b/c Objective-C is conceptually simpler than C++ there's fewer ways to shoot yourself in the foot.
There's not much point using it for new development unless your project is very self-contained or you're targeting Mac OS X or the iphone; moreover, Apple's pushed out Objective-C 2.0 recently, and are in the driver's seat for the language's future.
Personally, I prefer Java for the kinds of products Objective-C is supposed to be used for (desktop/mobile software). The tradeoffs:
- objective-c is lighter-weight and very simple to code in; Java is a lot clunkier and tedious to write; winner: obj-c
- java has a huge set of support infrastructure and tooling; obj-c has xcode (which is ok, but not great); winner: java
- java has generics that're mostly type-safe; obj-c doesn't really have any equivalent. I like type-safety when I can get it, so winner is java.
If you're learning objective-c to do Cocoa or UIKit development, you will spend much more time learning your way around Cocoa and/or UIKit than learning Objective-C; objective-c is like a week at the absolute longest, but Cocoa takes months to learn.
The first commandment of Cocoa: always respect convention; there's lots of semi-documented conventions (in terms of naming methods and arguments and ivars and so forth), and you should follow any conventions you see unless you understand what you give up by not following that particular convention.
There are two golden rules for Cocoa:
rule 1: if you're coding up something that seems like something any realistic application would have to include, you should take another look @ the docs b/c apple probably gave it to you already.
rule 2: a lot of functionality you'd expect to be in utility classes is buried in base classes (like NSObject, NSArray, NSDate, etc.).