On Feb 28, 2010, at 20:22, Jean-Henri Duteau wrote:

> What you're essentially suggesting is putting this code in the model and I 
> don't think it goes there.  The various strings that get displayed on the 
> view are for the purposes of the view only.  They don't have any use in the 
> model.
> 
> I explored using Transformer's some more because, after I wrote my last 
> response, I thought that it really is a Transformer that I need.  
> Unfortunately, I can't see any way to get access to the Transformer instance 
> that is attached to a binding.  It would work out if I did.  In my View 
> Controller's awakeFromNib:, I could iterate through all of the Transformer 
> instances and tell them what transform to do.
> 
> In the end, I may just bite the bullet and create the 20 Transfomer objects.  
> It will just be yucky code.

TBH, I think Chris Hanson's advice was spot on. You asked the list a question 
because (excuse me for going slightly beyond your actual words) you felt a 
slight discomfort with the solution you had already come up with, and I think 
Chris is pointing you in the correct direction for a resolution.

I'd say that the strings being "for the purposes of the view only" is *not* a 
valid reason for asserting that they "don't have any use in the model". If your 
application were to acquire another view or another window that showed the 
underlying data in a different format, would the same strings still be the 
appropriate user-visible representation of the data? It seems likely. (If not, 
why not?) In that case, the data model may well be the correct place to put the 
strings.

In other words, the fact that the strings are derived rather than primitive 
properties is not in itself a reason why they shouldn't be in the data model.

However, we're not going to get anywhere at this level of abstraction. Are you 
willing to share some more details on the data model's "one attribute" and its 
relationship with the strings? Even a contrived version of your actual 
situation would help make the discussion concrete -- and there are still some 
puzzling things, like why there are 20 strings for a single attribute. Or, is 
the single attribute an integer representing a bit mask with one bit for each 
possible string?


_______________________________________________

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