On Mar 4, 2009, at 5:12 PM, Jeff Laing wrote:

(For the record, when I add an IBOutlet to a class definition, I add the
corresponding assertion that its non-nil to the awakeFromNib method
because I *know* that I forget to connect those things up, and have
wasted days chasing unexpected 'nil' objects)

Great idea... I'm going to try that myself. Though, I don't do much nib stuff right now, b/c I'm still wrapped up in the Carbon world with pre-nib code.

One thing I wonder about in your example, however, is why you don't have the else cases populated? (I realise it's a coded-in-email example, but
it's the quality of the paranoia I'm interested in)  ie,  if I'm going
to be so paranoid as to check that the status bar exists, I'm going to
have a strategy for when it isn't.  ie,

Precisely.. code-in-email. I do handle all else cases, and wrap it all up inside exceptions. Kind of habit by now.

What I was kind of fishing for in the nil/NULL checking - was - to recognize that it seems Cocoa programmers are trending towards the lazy side (like Java); and there's too much "just trust the force, Luke" stuff going on there. Preventative programming seems to go right out the window, and what makes me think twice about all of this stuff is this - it's all sitting on top of C; and no amount of magic will help you track down gnarly memory overwrites and such, than trying to trap anomalies as soon as you can. The key, though, is not just checking for nil; as you mention. You have to respond/react to all alternate/undesirable/fringe cases in code - and bring it to the engineer's attention. Just some of the coding behaviors that I've learned along the way. Food for thought.

Thanks!
M

--
Mark D. Gerl, Multimedia Design Group, <mailto:mg...@mmdesigngrp.com>

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to