Skip navigation.
 
mlRe: How to notify of an error...
FROM : I. Savant
DATE : Tue Nov 06 16:43:41 2007

> I thought about just passing the window controller to the initWith
> section but to me that just seems like a waste of memory...


  Premature optimization. A single pointer to an interesting object on
a desktop computer really is nothing at all to worry about
memory-wise. After all, you're not making a copy of your window
controller, just referencing it ...

> In .NET I would use events, but I am not sure in Cocoa?


  In Cocoa you could use NSNotification ... however depending on your
requirements it might be simpler for the controller to call the
object's "open and parse the file" method, which would pass back the
overall status of the command, displaying an error if the status isn't
"a-okay".

  Many mechanisms within Cocoa itself already use this pattern
(they're handed an NSError** which is specified if there's a problem,
then the caller checks this error and displays it to the user if it's
set).

--
I.S.

Related mailsAuthorDate
mlHow to notify of an error... Tim Davis Nov 6, 16:27
mlRe: How to notify of an error... Shawn Erickson Nov 6, 16:39
mlRe: How to notify of an error... I. Savant Nov 6, 16:43