MVC....brief question

2009-07-07 Thread Michael de Haan

Hi all,
I have just completed my first little cocoa app.
Please, one brief question.

The app follows ( or tries to) the MVC model, using bindings. ( A  
view, a single NSObjectController, and a model)


 I also used the method



+ (NSSet *)keyPathsForValuesAffectingBmi  /* bmi is model Ivar */
{
return [ NSSet setWithObjects:@weight, @height, nil];
}


My question.  I included the above method in the model, as this is the  
only place available. I just wonder if this is correct?  (in a sense  
it enables the getter bmi. )


Apologies if this has previously been asked, or if there is a ref to  
this...I was not able to find it, but will gladly look if there is one.


Thanks in advance.

___

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


Re: MVC....brief question

2009-07-07 Thread Keary Suska

On Jul 7, 2009, at 6:31 AM, Michael de Haan wrote:


+ (NSSet *)keyPathsForValuesAffectingBmi  /* bmi is model Ivar */
{
return [ NSSet setWithObjects:@weight, @height, nil];
}


My question.  I included the above method in the model, as this is  
the only place available. I just wonder if this is correct?


The only appropriate location for the method is the object that has  
all of the referenced properties.



(in a sense it enables the getter bmi. )


Not in any sense, really. It simply tells all observers of bmi that  
bmi has changed every time weight or height changes.


Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business

___

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


Re: MVC....brief question

2009-07-07 Thread Michael de Haan


On Jul 7, 2009, at 7:16 AM, Keary Suska wrote:


On Jul 7, 2009, at 6:31 AM, Michael de Haan wrote:


+ (NSSet *)keyPathsForValuesAffectingBmi  /* bmi is model Ivar */
{
return [ NSSet setWithObjects:@weight, @height, nil];
}


My question.  I included the above method in the model, as this is  
the only place available. I just wonder if this is correct?


The only appropriate location for the method is the object that has  
all of the referenced properties.


Of course!  :-)




(in a sense it enables the getter bmi. )


Not in any sense, really. It simply tells all observers of bmi  
that bmi has changed every time weight or height changes.




Beginning to really appreciated the beauty of cocoa...but it's a  
steep learning curve!!




Thanks again for clarifying.

Michael.

___

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