Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Uli Kusterer
On 28.05.2013, at 19:28, Quincey Morris wrote: > Similarly, a MVC "view" is not necessarily a view. Rather, it's a component > of your app design that interacts with the user. It may be implemented as a > window, or as a view, or as a window with a hierarchy of vie

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Uli Kusterer
On 28.05.2013, at 19:01, YT wrote: > You have to disconnect the Auto generated Delegate from the Outlets > Connection in the File's Owner Object in the IB Doc > Please correct me if I am wrong about this point. > > All of you discuss the utilities of the following Controllers. > NSWindowContro

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Uli Kusterer
On 28.05.2013, at 19:01, YT wrote: > I did run a test and created a NEW Project and checked the box "Create a > Document-based App" > AND no Controller files (.h,.m) were automatically generated. "Controller" is a pattern, not a class name. When you create a document-based app, it creates a

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Quincey Morris
troller files (.h,.m)? A MVC controller is just an object that behaves like a controller. It doesn't have to have "controller" in its name to behave like a controller. It can be of any class, and the class you choose depends on what it's supposed to do. Keep in mind that the

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread YT
In the latest set of responses to my query "Building an MVC based App for Mac OS X - NOT iOS" The question of - am I building a "Document Based App"? After reading the Apple Document "Designing a Document-Based Application" I can say NO, I don't believe I a

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Uli Kusterer
On May 28, 2013, at 7:15 AM, Quincey Morris wrote: > In the broadest MVC terms, the "C" is often a NSWindowController subclass. > The "M" is often the app delegate *or* a NSDocument subclass, or is a more > specialized object graph to which the app delegate or

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-27 Thread Quincey Morris
7;s a document-based app, a NSDocument subclass -- for each window in your app a NSWindowController subclass In the broadest MVC terms, the "C" is often a NSWindowController subclass. The "M" is often the app delegate *or* a NSDocument subclass, or is a more specialized

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-27 Thread Jens Alfke
e files. > I found that (as a nubee) very disconcerting and confidence shaking with > regard to my experience with using an MVC. It’s pretty common to have a window controller, and make it responsible for managing the views in the window too. (NSViewController wasn’t added until OS X 10.5 or

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-27 Thread YT
artz 2D to draw graphics into and need a Controller. The Interface Builder was trying to force me to place ACTIONS AND OUTLETS in the Delegate files. I found that (as a nubee) very disconcerting and confidence shaking with regard to my experience with using an MVC. So in Step 1 above I created M

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-27 Thread Jens Alfke
On May 27, 2013, at 6:46 PM, Keary Suska wrote: > Mac OS X development os much more complicated than iOS development. It is not > likely somehting you can just dive into without a learning curve. Well, it’s different. Coming from OS X, I’ve found iOS UI development the more difficult of the t

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-27 Thread Keary Suska
t Controller files when creating an iOS based App. > > SO! I've been trying to create Controller files that I can set up > connections to like Target-Actions and Outlets in the Interface Editor. > So far I have not been successful using instructions I found in the Apple > Guid

Building an MVC based App for Mac OS X - NOT for iOS

2013-05-27 Thread YT
de on setting up an MVC for Mac OS X Apps or maybe there is a little know incantation some one might hare with me? Thanks YT I actually had a Snow Crash on my iMac. Maybe that is why I'm floundering. ___ Cocoa-dev mailing list (Cocoa-dev@lis

Re: Setting Up a MVC most of it works BUT

2013-05-10 Thread Jens Alfke
On May 9, 2013, at 6:57 PM, Graham Cox wrote: > a) the data model explicitly calls a method of the controller to tell it > about a change. This isn't great, because it sets up a strong dependency > between the data model classes and the controller class(es). > a+) the data model declares an in

Re: Setting Up a MVC most of it works BUT

2013-05-09 Thread Graham Cox
On 10/05/2013, at 10:35 AM, YT wrote: > BUT how does one send data from myDataModel to MyController. > OR is that by request from MyController only? Just to elaborate on my previous answer, there are several techniques that are commonly used to update an interface when something in the data m

Re: Setting Up a MVC most of it works BUT

2013-05-09 Thread Graham Cox
On 10/05/2013, at 10:35 AM, YT wrote: > BUT how does one send data from myDataModel to MyController. > OR is that by request from MyController only? It can be, but not exclusively. Sometimes your data model might want to "push" a value to the interface for display. It all depends on what it do

Setting Up a MVC most of it works BUT

2013-05-09 Thread YT
So I've spent the past few hours reading and am now trying to set up a simple MVC. I constructed a few buttons and textfields in a Window in IB The View will instantiate when the Xib is loaded (so I've read anyway) I created a MyController based on NSObject in the Xib SO once the Xib

Re: NSURLConnection and MVC

2012-09-19 Thread Graham Cox
n thinking about MVC, I find it's helpful sometimes to break it down into M-C-V (if you see what I mean) rather than trying to cram everything into one big controller. In this case, your controller only needs to know a) what sort of fetch it has to perform and so get the right subparts re

Re: NSURLConnection and MVC

2012-09-19 Thread Jens Alfke
On Sep 19, 2012, at 12:14 PM, Koen van der Drift wrote: > Thanks for the link, lots of info there. Unfortunately he doesn't > discuss the responsibility of the MVC classes in the slides regarding > the best location for the NSURLConnection code. I got that and the > paring alr

Re: NSURLConnection and MVC

2012-09-19 Thread Koen van der Drift
Thanks for the link, lots of info there. Unfortunately he doesn't discuss the responsibility of the MVC classes in the slides regarding the best location for the NSURLConnection code. I got that and the paring already working, but need to make it more flexible. - Koen. On Wed, Sep 19, 2012

Re: NSURLConnection and MVC

2012-09-19 Thread Chuck Soper
ble, because the way the controller and original >database class interact turns out to be very specific for the original >database. So I need to fix this, obviously, because there could be >more database classes in the future. Reading up on MVC and >NSURLConnection, I saw several posts on

NSURLConnection and MVC

2012-09-19 Thread Koen van der Drift
ne needs multiple. And of course it needs to be parsed differently. Now I am getting into trouble, because the way the controller and original database class interact turns out to be very specific for the original database. So I need to fix this, obviously, because there could be more database classes in

Re: MVC Theory Question

2011-12-29 Thread Mike Abdullah
On 28 Dec 2011, at 17:05, Philip McIntosh wrote: > > I am just wondering about something with respect to the Model-View-Controller > (MVC) design pattern. Should any validation of input or output be done by the > model class which is handling and processing the data, or is val

Re: MVC Theory Question

2011-12-28 Thread Keary Suska
On Dec 28, 2011, at 10:05 AM, Philip McIntosh wrote: > I am just wondering about something with respect to the Model-View-Controller > (MVC) design pattern. Should any validation of input or output be done by the > model class which is handling and processing the data, or is valida

MVC Theory Question

2011-12-28 Thread Philip McIntosh
I am just wondering about something with respect to the Model-View-Controller (MVC) design pattern. Should any validation of input or output be done by the model class which is handling and processing the data, or is validation more properly a task to be assigned to a controller class

Re: Getting a handle on CoreAnimation and MVC

2011-05-24 Thread Graham Cox
On 24/05/2011, at 11:49 PM, Joanna Carter wrote: > I would definitely argue that this kind of design is not really "cleaning up" > the design but, further, polluting it :-) > > In the Cocoa world, the Controller is a very important part of getting the > non-UI code to connect to the UI element

Re: Getting a handle on CoreAnimation and MVC

2011-05-24 Thread Joanna Carter
Hi Graham > Of course I'm simplifying when discussing MVC - I have rarely found a case > that's "pure" in the sense of just M, V and C as well, usually there are > several layers of controller and the data model is distributed among > different objects as well.

Re: Getting a handle on CoreAnimation and MVC

2011-05-24 Thread Graham Cox
On 24/05/2011, at 3:05 PM, Quincey Morris wrote: > On May 23, 2011, at 18:27, Graham Cox wrote: > >> Am I worrying too much? Or is there a better way to think about layers that >> means I don't have to give up on strict MVC? > > I'll take a stab at this --

Re: Getting a handle on CoreAnimation and MVC

2011-05-23 Thread Quincey Morris
On May 23, 2011, at 18:27, Graham Cox wrote: > Am I worrying too much? Or is there a better way to think about layers that > means I don't have to give up on strict MVC? I'll take a stab at this -- not pontificating, just expressing an opinion, and a hesitant one at that ...

Getting a handle on CoreAnimation and MVC

2011-05-23 Thread Graham Cox
static' view to draw the board, now I'm adding animation. The app strictly splits things according to MVC. I have model classes representing the 'board', which contains all the 'squares' and together these embody all the state information about the game. This is man

NSOobject as ViewController and MVC architecture

2010-11-06 Thread Sivakumar Kandappan Sivakumar
ches method. 2) If I have to pass a message from 1st controller to the 2nd controller. Should it be done through the rootviewControlller. 3) In the MVC architecture I know that Viewcontrollers have pointers to the views & data. But will the data and views have the pointer

Re: Regarding MVC design pattern

2010-05-20 Thread mmalc Crawford
On May 20, 2010, at 7:40 am, Thomas Davie wrote: >> However, you should typically not invoke accessor methods in init or dealloc >> methods. > > Can I ask why you shouldn't use them in init? It makes a lot of sense to not > use them in alloc/dealloc, but I'm not using them in init... after al

Re: Regarding MVC design pattern

2010-05-20 Thread Kyle Sluder
On Thu, May 20, 2010 at 9:27 AM, Dave Keck wrote: > I'm not a fan of isInitialized either, but even less enthralled by > duplicated code. Furthermore, couldn't one make the case that a class > that's well-fit for subclassing has exactly one technique for setting > a property (the setter), giving s

Re: Regarding MVC design pattern

2010-05-20 Thread Dave Keck
> You can get away with a lot of things if you don't care about writing > subclass-tolerant code. But since I don't have a crystal ball, I don't > write code which I know will require hacky "isInitialized" flags to be > correct. I'm not a fan of isInitialized either, but even less enthralled by du

Re: Regarding MVC design pattern

2010-05-20 Thread Kyle Sluder
On Thu, May 20, 2010 at 8:27 AM, Dave Keck wrote: > Which could be solved with a simple if-statement within the subclass' > -setContent:, allowing you to use accessors everywhere to avoid code > duplication and giving your subclasses full control over the setting > of the content property. You ca

Re: Regarding MVC design pattern

2010-05-20 Thread Dave Keck
> I'll give you a concrete example. We have an NSController-like class that > lives in a framework. Its designated intializer is -initWithContent:. In one > of our apps, we have a subclass of this whose initializer is > -initWithDocument:, and which uses the document to figure out its content. > It

Re: Regarding MVC design pattern

2010-05-20 Thread glenn andreas
On May 20, 2010, at 9:47 AM, Thomas Davie wrote: > > On 20 May 2010, at 15:45, Barry Skidmore wrote: > >> If you need to have it set you should create an initWithOptionName: and call >> that from your standard init, or return an error stating a missing value is >> needed. >> >> Your init sho

Re: Regarding MVC design pattern

2010-05-20 Thread Kyle Sluder
On May 20, 2010, at 7:40 AM, Thomas Davie wrote: Can I ask why you shouldn't use them in init? It makes a lot of sense to not use them in alloc/dealloc, but I'm not using them in init... after all, what if I replace the ivar with a derived property from another object? Why should I have t

Re: Regarding MVC design pattern

2010-05-20 Thread Barry Skidmore
Ah I see. Not that I am aware of, in fact if you require a set property in your object then init is the best place for it to be. Sent from my iPhone On May 20, 2010, at 9:47 AM, Thomas Davie wrote: On 20 May 2010, at 15:45, Barry Skidmore wrote: If you need to have it set you should cre

Re: Regarding MVC design pattern

2010-05-20 Thread Thomas Davie
On 20 May 2010, at 15:45, Barry Skidmore wrote: > If you need to have it set you should create an initWithOptionName: and call > that from your standard init, or return an error stating a missing value is > needed. > > Your init should always call down tithe most specific init. > > Specific e

Re: Regarding MVC design pattern

2010-05-20 Thread Barry Skidmore
If you need to have it set you should create an initWithOptionName: and call that from your standard init, or return an error stating a missing value is needed. Your init should always call down tithe most specific init. Specific examples of this are available as best practice in several c

Re: Regarding MVC design pattern

2010-05-20 Thread Thomas Davie
On 20 May 2010, at 15:24, mmalc Crawford wrote: > > On May 19, 2010, at 4:38 am, Sherm Pendley wrote: > >> If you set the ivars directly, as above, the synthesized setters will >> NOT be called. For that to happen, you need to use dot-syntax, like >> this: >> >> - (void) dealloc { >> self.be

Re: Regarding MVC design pattern

2010-05-20 Thread mmalc Crawford
On May 19, 2010, at 1:48 am, Sai wrote: > 1. Look at the awakeFromNib method of Controller, my output of the retain > count to the console are > myModel retain count: 5 > controller retain count: 17 > both number are very surprised me, why is that? I suppose they should be 2 > or 1? > Can anyone

Re: Regarding MVC design pattern

2010-05-20 Thread mmalc Crawford
On May 19, 2010, at 4:38 am, Sherm Pendley wrote: > If you set the ivars directly, as above, the synthesized setters will > NOT be called. For that to happen, you need to use dot-syntax, like > this: > > - (void) dealloc { >self.beginButton = nil; >self.endButton = nil; >// etc... >

Re: Regarding MVC design pattern

2010-05-20 Thread Kyle Sluder
On Thu, May 20, 2010 at 5:44 AM, Joanna Carter wrote: > Le 20 mai 2010 à 13:24, Alexander Spohr a écrit : > Yes, because the ivar is synthesised, addressing myFoo would send the release > message to the property, which is not recommended. No. "Send the release message to the property" is a meani

Re: Regarding MVC design pattern

2010-05-20 Thread Joanna Carter
Le 20 mai 2010 à 13:24, Alexander Spohr a écrit : > Why not just using myFoo without the self->? > To make it visible that you talk to an ivar? Yes, because the ivar is synthesised, addressing myFoo would send the release message to the property, which is not recommended. Apparently, self->myFo

Re: Regarding MVC design pattern

2010-05-20 Thread Alexander Spohr
Am 19.05.2010 um 19:12 schrieb Kyle Sluder: > On Wed, May 19, 2010 at 4:38 AM, Sherm Pendley > wrote: > If you synthesize your ivars, you can get at the ivar using the self-> syntax. > > self->myFoo = [aFoo retain]; > [self->myFoo release]; Why not just using myFoo without the self->? To ma

Re: Regarding MVC design pattern

2010-05-19 Thread Kyle Sluder
On Wed, May 19, 2010 at 4:38 AM, Sherm Pendley wrote: > If you set the ivars directly, as above, the synthesized setters will > NOT be called. For that to happen, you need to use dot-syntax, like > this: But you shouldn't be using accessors in -init or -dealloc anyway. It makes subclassing fragil

Re: Regarding MVC design pattern

2010-05-19 Thread Joanna Carter
Hi Sherm > If you set the ivars directly, as above, the synthesized setters will > NOT be called. For that to happen, you need to use dot-syntax, like > this: You are absolutely right. I keep slipping back to previous languages :-) Joanna -- Joanna Carter Carter Consulting

Re: Regarding MVC design pattern

2010-05-19 Thread Sherm Pendley
On Wed, May 19, 2010 at 6:31 AM, Joanna Carter wrote: > Any outlets for controls (top level objects) in the Nib should be released in > the dealloc method only for OS X apps but not for iPhone apps. Setting the > properties to nil will ensure that the synthesized setter will be called, > which

Re: Regarding MVC design pattern

2010-05-19 Thread Joanna Carter
Hi Guys Can I just suggest something more? > @interface Controller : NSObject { >IBOutlet UIButton *beginButton; >IBOutlet UIButton *endButton; >IBOutlet UILabel *nameLabel; >IBOutlet UILabel *numberLabel; >MyModel *myModel; > } > > @property (nonatomic, retain) IBOutlet MyMo

Re: Regarding MVC design pattern

2010-05-19 Thread Jack Nutting
On Wed, May 19, 2010 at 11:17 AM, Sai wrote: > Hi Jack, > Thank you for your quick response. Your answer is very useful. > Since I have pasted some of my codes in the previous mail. I just > wonder if you have any comments on my codes, anything I can > improve for this little app? Any advice will

Re: Regarding MVC design pattern

2010-05-19 Thread Sai
Hi Jack, Thank you for your quick response. Your answer is very useful. Since I have pasted some of my codes in the previous mail. I just wonder if you have any comments on my codes, anything I can improve for this little app? Any advice will be very appreciated. On Wed, May 19, 2010 at 5:07 PM,

Re: Regarding MVC design pattern

2010-05-19 Thread Jack Nutting
On Wed, May 19, 2010 at 10:48 AM, Sai wrote: > I have two questions: > 1. Look at the awakeFromNib method of Controller, my output of the retain > count to the console are > myModel retain count: 5 > controller retain count: 17 > both number are very surprised me, why is that? I suppose they shoul

Re: Regarding MVC design pattern

2010-05-19 Thread Sai
Hi all, I have gone through the Memory Management Programming Guide document last night, and modify my codes a little bit. Even the program runs well without crashing, but I still have some questions remained. I will attach some of my codes as follow: 1. I have both Controller Object and MyModel

Re: Regarding MVC design pattern

2010-05-18 Thread Uli Kusterer
On May 18, 2010, at 1:20 PM, Sai wrote: > Anyway, why I should retain that? Because otherwise it will get autoreleased, but your instance variable will still contain its address, and the next time you try to use it via the instance variable, you will try to talk with random memory at that addre

Re: Regarding MVC design pattern

2010-05-18 Thread Kyle Sluder
On May 18, 2010, at 4:20 AM, Sai wrote: Hi all, Thanks for your reply. I didn't retain that, I will try that as soon as I get home. Anyway, why I should retain that? Will it be released by "somebody"? Re-read the Memory Management Programming Guide until you know the rules backwards and

Re: Regarding MVC design pattern

2010-05-18 Thread Sai
Hi all, Thanks for your reply. I didn't retain that, I will try that as soon as I get home. Anyway, why I should retain that? Will it be released by "somebody"? Can anyone tell me the whole process and what's going on please? I want to know what happened. Thanks a lot. On Tue, May 18, 2010 at 7:0

Re: Regarding MVC design pattern

2010-05-18 Thread Jack Nutting
On Tue, May 18, 2010 at 12:40 PM, Sai wrote: > However, I declare a NSDictionary instance variable in my model object. This > NSDictionary instance > store some data I need. And I will create this NSDictionary instance by > invoking: > [NSDictionary dictionaryWithObjects:names forKeys:keys] Are y

Re: Regarding MVC design pattern

2010-05-18 Thread Alexander Spohr
Am 18.05.2010 um 12:40 schrieb Sai: > Unfortunately, when I try to get value from that NSDictionary, I will get > exc_bad_access signal, and I follow gdb, the NSDictionary instance seems to > be corrupted. > So where does it go wrong? Hopefully I state things clearly this time. Thank > you all.

Re: Regarding MVC design pattern

2010-05-18 Thread Joanna Carter
Hi Sal > However, I declare a NSDictionary instance variable in my model object. This > NSDictionary instance > store some data I need. And I will create this NSDictionary instance by > invoking: > [NSDictionary dictionaryWithObjects:names forKeys:keys] > Both names and keys are string NSArray. I

Re: Regarding MVC design pattern

2010-05-18 Thread Sai
2010, at 10:56 AM, Sai wrote: > > > Hi All, > > I am new to cocoa development. Suppose I have an iPhone application > follow > > the MVC design pattern. > > The Model is presented by an custom object. And I have declared an > instance > > of the Model Object as a I

Re: Regarding MVC design pattern

2010-05-17 Thread Bill Hernandez
On May 17, 2010, at 12:33 AM, Quincey Morris wrote: > Your Model is being initialized because the NIB file that contains it is > being loaded. The gory details of what happens can be found here: > > > http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/LoadingResources/

Re: Regarding MVC design pattern

2010-05-16 Thread Quincey Morris
On May 15, 2010, at 10:56, Sai wrote: > Suppose I have an iPhone application follow > the MVC design pattern. > The Model is presented by an custom object. And I have declared an instance > of the Model Object as a IBOutlet > in my Controller class. I found that every time I start

Re: Regarding MVC design pattern

2010-05-16 Thread Henry McGilton
On May 15, 2010, at 10:56 AM, Sai wrote: > Hi All, > I am new to cocoa development. Suppose I have an iPhone application follow > the MVC design pattern. > The Model is presented by an custom object. And I have declared an instance > of the Model Object as a IBOutlet > in m

Regarding MVC design pattern

2010-05-16 Thread Sai
Hi All, I am new to cocoa development. Suppose I have an iPhone application follow the MVC design pattern. The Model is presented by an custom object. And I have declared an instance of the Model Object as a IBOutlet in my Controller class. I found that every time I start my application, this

Re: MVC question about updating the Model

2010-04-16 Thread Kyle Sluder
On Fri, Apr 16, 2010 at 11:24 AM, Quincey Morris wrote: > I think that in this case, if the auto-updating can *safely and correctly* be > encapsulated within a single object, then it's preferable and simpler just to > do so. This is true, but it does depend on your definition of "safely and cor

Re: MVC question about updating the Model

2010-04-16 Thread Quincey Morris
On Apr 16, 2010, at 11:00, Kyle Sluder wrote: > And this is when I become a fan of splitting the "model" layer into a > "model object" layer and a "model controller" layer. I think that in this case, if the auto-updating can *safely and correctly* be encapsulated within a single object, then it'

Re: MVC question about updating the Model

2010-04-16 Thread Kyle Sluder
On Fri, Apr 16, 2010 at 10:51 AM, Quincey Morris wrote: > For timed updates, you seem to have a choice of putting the timer in your > data model, or putting the timer in your window controller. One good way to > decide this is to ask yourself this question: And this is when I become a fan of sp

Re: MVC question about updating the Model

2010-04-16 Thread Quincey Morris
On Apr 16, 2010, at 06:30, Matt DeFoor wrote: > This is where I'm having difficulty determining what should be > standard practice. Would it be better to post a notification that > indicates the resource should update itself? Or is it good enough to > leave it as is? > > One other approach I've c

Re: MVC question about updating the Model

2010-04-16 Thread Graham Cox
On 16/04/2010, at 11:30 PM, Matt DeFoor wrote: > One other approach I've considered is whether the Model should have > the ability to update itself at all. Should the controller be > responsible for updating the resource always? No, because if another controller is able to affect the model, the

Re: MVC question about updating the Model

2010-04-16 Thread Joanna Carter
Hi Matt > I have multiple resource objects that are represented in an > NSOutlineView. These resource objects can be updated by their own > triggered timer or potentially on demand by the user via the View (a > button is clicked in the UI). > > At first, I thought that the resource object should

MVC question about updating the Model

2010-04-16 Thread Matt DeFoor
I'm having a problem deciding on how a Model object should be updated. I have multiple resource objects that are represented in an NSOutlineView. These resource objects can be updated by their own triggered timer or potentially on demand by the user via the View (a button is clicked in the UI). A

Re: Where in the MVC should my code go?

2010-03-01 Thread Jean-Henri Duteau
On 2010-03-01, at 3:20 PM, Chase Meadors wrote: > 2. On the other hand, if you want the view to be more independent and > flexible as according to MVC, you have more options. If you're binding > the model to the view, you can simply use a custom NSValueTransformer > cla

Re: Where in the MVC should my code go?

2010-03-01 Thread Chase Meadors
view to be more independent and flexible as according to MVC, you have more options. If you're binding the model to the view, you can simply use a custom NSValueTransformer class to change your model attribute to an array of strings. Or you can simply factor the code into the view contro

Re: Where in the MVC should my code go?

2010-02-28 Thread Quincey Morris
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. >

Re: Where in the MVC should my code go?

2010-02-28 Thread Jean-Henri Duteau
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

Re: Where in the MVC should my code go?

2010-02-28 Thread Chris Hanson
On Feb 27, 2010, at 11:34 PM, Jean-Henri Duteau wrote: > 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 > tra

Re: Where in the MVC should my code go?

2010-02-27 Thread Jean-Henri Duteau
;> 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 pa

Re: Where in the MVC should my code go?

2010-02-27 Thread Matthew Lindfield Seager
s so it may be worth splitting roles earlier rather than later. > Advice? Read Cocoa Design Patterns by Buck & Yacktman... It's excellent reading (& not just for its treatment of MVC). Matt ___ Cocoa-dev mailing list (Cocoa-dev@lists.ap

Where in the MVC should my code go?

2010-02-27 Thread Jean-Henri Duteau
I have an interesting MVC question that I would like some advice on. I have a Model object with one attribute. On my View, I display an array of strings that depend upon the value of the model's attribute. I'm unsure where to put the "translation" of the Model attrib

Re: MVC design Q - remembering Core Data selections

2010-01-25 Thread Ken Tabb
Hi Ron, thanks for the reply. I agree just storing the "last known thing that the user was looking at" is doable, wouldn't require a non-MVC model- based hack, and would make for a much smaller user defaults file - as there's only 3 selections being stored (1x Compan

Re: MVC design Q - remembering Core Data selections

2010-01-25 Thread Jerry Krinock
I agree with Ron that this definitely looks like a user default because it's more a part of the View than the Model, and therefore should go into user defaults instead of the Core Data model. You often find attributes like this which could go either way. For a less certain example, consider th

Re: MVC design Q - remembering Core Data selections

2010-01-25 Thread Ron Fleckner
cular. The hack that I can think of to do this would be for each Company entity to have a "selectedDept", and for each Department entity to have a "selectedEmployee" relationship, but this kind of breaks MVC... other than it being easy to implement, the model shouldn'

Re: MVC design Q - remembering Core Data selections

2010-01-25 Thread Ken Tabb
rticular. The hack that I can think of to do this would be for each Company entity to have a "selectedDept", and for each Department entity to have a "selectedEmployee" relationship, but this kind of breaks MVC... other than it being easy to implement, the model shouldn't c

MVC design Q - remembering Core Data selections

2010-01-25 Thread Ken Tabb
be for each Company entity to have a "selectedDept", and for each Department entity to have a "selectedEmployee" relationship, but this kind of breaks MVC... other than it being easy to implement, the model shouldn't care what the user was last looking at. Furthermore if

Re: Question about MVC

2009-12-18 Thread Michael de Haan
Thanks Jens, I thought it was something like that. On Dec 18, 2009, at 9:21 AM, Jens Alfke wrote: > > On Dec 18, 2009, at 7:37 AM, Michael de Haan wrote: > >> So, why would one not simply use an NSMutableArray and simple add or delete >> model objects. I suspect part of the answer is that ass

Re: Question about MVC

2009-12-18 Thread Jens Alfke
On Dec 18, 2009, at 7:37 AM, Michael de Haan wrote: > So, why would one not simply use an NSMutableArray and simple add or delete > model objects. I suspect part of the answer is that assigning a new array > allows easier use of KVC but I am not sure as this is not specifically > explained.

Question about MVC

2009-12-18 Thread Michael de Haan
In Cocoa Design Patterns, Chap 29 re-creates, from scratch, an NSArrayController, dissecting in great detail how it works. The example essentially is a very rudimentary drawing program, which shows rectangles in a view, with a table showing the coordinates of the same. My question relates to th

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Sandro Noël
Thank you all, it cleared things up quite a bit. Best regards. Sandro. ___ 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.ap

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Graham Cox
On 30/11/2009, at 1:35 PM, Jason Stephenson wrote: > NSDocument doesn't merely represent the document's data as in a "pure" MVC > design, rather it is a controller for the document's data. The subsection of > the Document-Based Applications Overview entitled

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Jason Stephenson
Graham Cox wrote: On 30/11/2009, at 12:04 PM, Jason Stephenson wrote: NSDocument and the document-based architecture in Cocoa is a bad example of MVC. As a statement that doesn't really stand up to scrutiny. Sure, you can abuse NSDocument and violate MVC, but as it comes it does n

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Bill Garrison
On Nov 29, 2009, at 6:58 PM, Sandro Noël wrote: From what I read the MyDocument Class is supposed to be a model controller, not the window controller. The MyDocument Class is supposed to be able to host an array of window controllers. NSDocument has the capability to host an array of windo

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Chris Hanson
On Nov 29, 2009, at 5:47 PM, Sandro Noël wrote: I have to agree with you here, NSDocument should be just M in the MVC Pattern, but why is XCode evidently binding it as the C also in the template project. Because not every project needs to be picture perfect in its use of various

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Sandro Noël
On 2009-11-29, at 8:18 PM, Graham Cox wrote: > > On 30/11/2009, at 12:04 PM, Jason Stephenson wrote: > >> NSDocument and the document-based architecture in Cocoa is a bad example of >> MVC. > > > As a statement that doesn't really stand up to scrutiny. Su

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Graham Cox
On 30/11/2009, at 12:04 PM, Jason Stephenson wrote: > NSDocument and the document-based architecture in Cocoa is a bad example of > MVC. As a statement that doesn't really stand up to scrutiny. Sure, you can abuse NSDocument and violate MVC, but as it comes it does not. A documen

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Jason Stephenson
outlet to the MyDocument Class. NSDocument and the document-based architecture in Cocoa is a bad example of MVC. By default when creating a document-based application in Xcode, you get what I like to call MC-V where the model and controller are wrapped up in one object. This is very often easie

Apple MVC and Document Based application confusion.

2009-11-29 Thread Sandro Noël
Hello. I'm reading COCOA Design Patterns from Eric M. Buck & Donald A. Yacktman. and i'm having a hard time applying the principle in my architecture. for example, if i create a new document based application in XCode, the MyDocument xib file binds the window outlet to the MyDocument Class. Fr

Re: Bindings, am I doing right by MVC?

2009-10-23 Thread Keary Suska
On Oct 23, 2009, at 11:52 AM, Paul Bruneau wrote: But I wonder about my edit fields. They are bound like: Bind to: File's owner (a NSWindowController subclass) Controller Key: Model Key Path: door.backset (door is an ivar of the window controller--it's the door that the window controller is

Bindings, am I doing right by MVC?

2009-10-23 Thread Paul Bruneau
I'm trying to do things correctly in my new app that I am writing, so I wanted to ask this question because I'm not sure if I am. I have a window for a "door" object in my document (NSDocument based app). It's a good thing I don't work for a window company or things would be really confusin

Re: Examples of MVC pattern with Core Data

2009-10-14 Thread I. Savant
On Oct 14, 2009, at 11:29 AM, Kyle Sluder wrote: On Oct 14, 2009, at 7:03 AM, Darren Wheatley > wrote: I've been Googling and searching the XCode docs for good examples of using the MVC pattern with Core Data, but not had a lot of success. Because MVC is so pervasive througho

  1   2   >