Search code examples
javaobjective-cprogramming-languages

Resources to compare Java to Objective-C (syntax and basics)


I have taught myself a lot of Objective-C over the past year and a half, and have even been able to publish some iOS apps on the App Store. Concepts that were foreign to me before about object oriented programming are now second nature and I understand MVC, inheritance, polymorphism etc. I'm now interested in learning to develop for the Android platform, which will entail learning Java. I want to find resources that can match up Java basics with regards to syntax and structure with the same things from the Objective-C world.

The Wikipedia entry for Objective-C has exactly what I'm looking for with regards to how Objective-C relates to C++. If there is a document, blog post or book dedicated to something like this for Java in relation to Objective-C I would be all over it like a bear on honey. It should include things like

  • Class method declarations and implementations
  • instance method declarations and implementations
  • How to compose a method name (ie +/-(returntype)methodName:(type)argument; )
  • declaring properties

Thank you for all of your suggestions!


Solution

  • "Matching up syntax" is not necessarily a useful thing. The two languages are not merely different syntaxes for the same thing. Lots of people go into a new language with that mindset, and it leads them to write bad code in their new language. For example, class methods in Objective-C are roughly equivalent to static methods in Java, but class methods can be overridden in subclasses while static methods can only be hidden by new static methods — they're more similar to namespaced functions than methods.

    Better to just learn Java from a good book or tutorial — without your baggage from Objective-C.