Program 3.2 has (with comments I added):
Fraction *myFraction; // Note not initialised yet.
myFraction = [Fraction alloc]; // Allocate memory - inherited
myFraction = [myFraction init]; // Initialise - inherited
I understand [Fraction alloc], which allocates memory and returns a pointer to the object. That's clear. [myFraction init] initialises the object, which may not do anything in this example, but will be required for many real-world objects.
But I'm a bit puzzled by the need to assign the result of [myFraction init] to myFraction. The object already has an address, and putting in a few NSLog calls reveals that the pointer in myFraction has the same value before and after the [myFraction init] call. I can immagine scenarios where that might be necessary, but they don't seem very plausible.
Is this actually a useful convention?