On Thu, Jul 2, 2009 at 2:25 PM, Andy Lee<ag...@mac.com> wrote:
> My first reaction was: "Elegantly put!"  But then I thought, isn't *not* 
> generating this kind of code one of the reasons we tell people nibs are good? 
>  Wouldn't a .m be a good place to "document" targets and actions as well?  
> And delegates and other outlets?  Or do you think there's something about 
> bindings that makes them subtle enough that for *them*, in some cases, it 
> might make sense to "document" them by coding them?

If you've decided that it will be better for the long-term health of
your application to document your bindings, it really isn't that hard
to do it in code rather than a text file.  I mean how is this:

nameTextField.value -> [Array Controller].arrangedObjects.name
|- Value Transformer: CapitalizeTransformer
|- Null Placeholder: <null>
|- Multiple values placeholder: <multiple selection>

all that different from this:

- (void)awakeFromNib {
  [nameTextField bind:@"value" toObject:arrayController
withKeyPath:@"arrangedObjects.name" options:
    [NSDictionary dictionaryWithObjectsAndKeys:
      @"CapitalizeTransformer", NSValueTransformerNameBindingOption,
      @"<null>", NSNullPlaceholderBindingOption,
      @"<multiple selection>", NSMultipleValuesPlaceholderBindingOption, nil]];
}

The important point is that your binding setup needs to get
complicated enough to warrant documentation in the first place -- from
there the extra effort required to get your documentation to compile
is trivial compared to the effort of documentation in the first place.
 Target-action setups rarely get this complicated; most of the time
you just wire up your controls to First Responder.

--Kyle Sluder
_______________________________________________

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