Re: Where in the MVC should my code go?
Re: Where in the MVC should my code go?
- Subject: Re: Where in the MVC should my code go?
- From: Jean-Henri Duteau <email@hidden>
- Date: Sun, 28 Feb 2010 00:34:29 -0700
On 2010-02-28, at 12:23 AM, Matthew Lindfield Seager wrote:
> On Sunday, February 28, 2010, Jean-Henri Duteau <email@hidden> wrote:
>> I don't have a good reason to not put it into the view other than pragmatic. I can give the controller a bunch of attributes and bind the view's controls to those attributes, as opposed to programatically creating the strings in the view.
>
> For small applications or simple situations it is not uncommon to
> combine two roles into the one object (e.g. combining controller &
> view functions or controller & model functions into one object).
>
I understand that. I've already split the functions - I have a View, a ViewController, and a Model. My question is more one of where does this code reside. I'm confident that it's not model code - the model could care less about these strings. I'm not as confident with my existing choice of the controller and was hoping someone could come swooping in and say "of course that is view code and here is why, you fool!" or "rest easy, young padawan, that is obvious controller code".
>
>> Advice?
>
> Read Cocoa Design Patterns by Buck & Yacktman... It's excellent
> reading (& not just for its treatment of MVC).
Thanks. I have that book and have read it a couple of times. In my opinion, it is one of the best programming books around. By explaining the patterns that underly the various Cocoa APIs, it really allows anyone coming from outside of Cocoa to understand it.
Having said that, I was hoping for more practical advice as I indicated above. *smile*
BTW, I've already considered a Transformer. The problem with that is one of code bloat - I have multiple fields on the view that are derived from this one attribute. I haven't figured out a way at design time in IB to make one transformer handle the different transformations.
Jean_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden