obj-j bits

Gotcha bits, taken from obj-j tutorial.

  • Objective-J has two types of objects, native JavaScript objects and Objective-J objects
  • The beginning of a class is always the keyword @implementation, followed by the class name
  • Each method signature starts with either a dash (-) or a plus (+)
  • Dashes are used for instance methods
  • One pattern you’ll find in Objective-J and Cappuccino is the idea of passing a method as an argument to another method
  • The alloc class method is analogous to the “new” keyword in many languages
  • The init instance methods are like the constructors in those languages, in that they perform initialization on the newly created instance
  • Some classes specify their own custom init method
  • “self” is the Objective-J equivalent to JavaScript’s “this”
  • There are two types of import statements. The angle brackets indicate framework code, while the quotation marks indicate local project code
  • JavaScript is garbage collected, and so is Objective-J, so you won’t see any calls to retain or release in Objective-J code as you would in Objective-C
  • Categories allow you to add methods to a class without needing to create a new subclass or modify the class’s source code
  • The syntax for the category is @implementation, followed by the class you’re adding to, followed by the name of your category in parentheses
  • Technique called toll-free bridging which allows any JavaScript object like an array or a string to act both as a JavaScript object and a Cappuccino object at the same time
  • Variables not specifically declared with var become globals
$1.99 domains with SSL purchase!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">