JLinX – Blog

Weblog von Jan Linxweiler

Cocoa Coding

Cocoa Programming for Mac OS X – Notes

A Little History

ObjC is weakly typed (p. 2).

Objects, Classes, Methods, and Messages

Attributes are called instance variables.
An object is an instance of a class.
Functions are called methods. To call a method, you send the object a message.
(p. 5)


Cocoa is made up of three frameworks:
Foundation: Every object-oriented programming language needs the standard value, collection, and utility classes. Strings, dates, lists, threads, and timers are in the Foundation framework.

AppKit: All things related to the user interface are in the AppKit framework. Windows, buttons, text fields, events, and drawing classes are in the AppKit. You will also see this framework called the ApplicationKit.

Core Data: Core Data makes it easy to save your objects to a file and then reload them into memory. We say that Core Data is a persistence framework.
(p. 6)

How to Read This Book


Most of the time, Cocoa fulfills the promise: Common things are easy, and uncommon things are possible.
(p. 7)

Typographical Conventions

  • In Objective-C, class names are always capitalized.
  • In Objective-C, method names start with a lowercase letter.

(p. 7)

Common Mistakes

  • Capitalization mistakes happen because C and Objective-C are case-sensitive languages.
  • Forgotten connections usually allow your application to build and run but result in aberrant behavior. If your application is misbehaving, go back to Interface Builder and check your connections.
  • It is easy to miss some warnings the first time a file is compiled. If you are stuck, try cleaning and

(pp. 7-8)

How to Learn

  • Remain focused on the topic at hand.
  • Get enough sleep.
  • Stop thinking about yourself.

(p.8 )

The cool kids say:
“The objects are archived into the nib file by Interface Builder and unarchived when the application is run.”
(p. 14)

Create a Class

In Objective-C, every class is defined by two files: a header file and an implementation file. The header file, also known as the interface file, declares the instance variables and methods your class will have. The implementation file defines what those methods do.
(p. 17)