This is a mirror of official site: http://jasper-net.blogspot.com/

Objective-C for Java Programmers

| Thursday, April 22, 2010
The design of Java was heavily inspired by Objective-C, but many people find learning Objective-C after Java to be a difficult challenge. In the first of a two-part series, David Chisnall, author of Cocoa Programming Developer’s Handbook, looks at the similarities and differences in the semantics of the two languages.

Objective-C was created back in 1986, but was a very niche language for much of this time. The main backer was NeXT, a company that shipped only 50,000 computers over the course of a decade, limiting the language’s exposure considerably. When Apple bought NeXT, this started to change. Objective-C became the primary language for development on the Mac, giving it somewhere up to around 5-10 percent of the desktop application development market share. Objective-C wasn't the only supported development language on OS X though, and a lot of developers used things that they were more familiar with. The iPhone, in contrast, did not support anything other than Objective-C for third-party development.

If you're coming to either platform from a Java background, then you might find the change daunting. Objective-C looks very different to Java. Fortunately, once you get past the syntax, the languages are quite similar, and you'll find that the transition is not as difficult as the syntax might imply.

A number of the Java designers had experience with Objective-C, including some who had worked with NeXT on the OpenStep specification. A lot of ideas in Java are lifted directly from Objective-C, or taken from Smalltalk, which inspired both languages. That's not to say that everything is the same in Objective-C. There are some important differences, which I'll explore in this and the next article.
Language Philosophies

Objective-C was designed to bring the encapsulation support that Smalltalk enjoyed to the C language. One of its designers described it as a hybrid language, with the square bracket syntax as a sign indicating the transition from C code to 'object land.'

Read more: InformIT Part 1, Part 2

Posted via email from jasper22's posterous

0 comments: