ace1009
1
The book specifies that
and
are the same. I understand one is meant for convenience but is one way better practice than the other?
I am also curious whether nesting a message or not is better practice. It just says that nesting is more difficult to read and decipher.
Awesome books and thanks in advance for the help!
ibex10
2
Both should do the same thing.
You should also be able to do:
NSDate *now = [NSDate new];
However, since the first one is more explicit, one can argue that it is a better choice.
Nesting makes the code more difficult to debug by hand or by using the debugger.
However, nesting alloc and init… methods has become the norm.
endertw
3
I think it’s by pure coincidence that the init method also does what the date method does? (return the current date)