Re: Controller layer and application design
Re: Controller layer and application design
- Subject: Re: Controller layer and application design
- From: mmalcolm crawford <email@hidden>
- Date: Wed, 17 Dec 2003 03:38:18 -0800
On Dec 17, 2003, at 1:25 AM, I wrote:
Perhaps a "compromise": Method 3 :-)
A variant on Method 1, where the array controller has a mutable
dictionary instance variable which serves as a temporary placeholder
for values for new object. The dictionary is bound to the text fields
with keys the same as the keys for the new object. These are set in
the controller's newObject method using
setValuesForKeysWithDictionary: -- see:
<http://homepage.mac.com/mmalc/CocoaExamples/Method3.zip>
This gives a compact design, whilst still retaining flexibility.
Hmm, although this *might* be "clever", it suffers from the problem
that you won't benefit from any validation logic you put into your
model. So thinking back to Method 2, and combining it with Method 3:
<
http://homepage.mac.com/mmalc/CocoaExamples/Method4.zip>
In this example, the array controller manages a single instance of the
class, which it then copies to add to its array. The custom class
implements NSCopying.
This is a little more "involved", but more on the model side than the
controller side.
It's also written way past my bedtime, so maybe my mind will be clearer
later in the morning... :-)
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.