Undo for edits


#1

On page 154, for the setter method, why do we remove the check about a and employees being the same object?? Remove observation and restarting observation for the same object will be a waste of time, right?
Unless I am missing something. Here is my version :

[code]- (void)setEmployees:(NSMutableArray *)a {
if (a == employees) {
return;
} // missing from page 154

for (Person *person in employees) {
    [self stopObservingPerson:person];
}

employees = a;

for (Person *person in a) {
    [self startObservingPerson:person];
}

}[/code]


#2

The main reason is that, because ‘a’ is a mutable array, its contents could have changed while the pointer remains the same. So if we check the pointer value we would be missing objects being added or removed.

Adam