Re: Property List Serialization in Sketch
Re: Property List Serialization in Sketch
- Subject: Re: Property List Serialization in Sketch
- From: Gordon Apple <email@hidden>
- Date: Thu, 10 Jan 2008 13:13:29 -0600
The 10.5 Sketch has apparently been greatly upgraded, and is eyeball
deep in bindings and KVOs, so much so that it requires substantial study and
really needs an extensive tutorial. I guarantee that you'll be well versed
in both if you get through it and understand it. Our architecture is
radically different, but we've still been able to lift/modify a substantial
amount of code from it.
Some of the differences are there is a single "Shape" class with a
dictionary of properties. Shapes donĀ¹t draw -- there is a separate
rendering class that is very straightforward, handles drawing, selection
handles, hit detection, etc., with a simple API and no external object
references (except to handle the shadow scaling fiasco). The main view
subclass has one method -- it overrides "draw" to call the display
controller. There is a display controller and an edit controller, the later
being an NSResponder subclass inserted as the view's "nextResponder". This
partitioning (and a variety of single-purpose controllers) allows multiple
reuse in different nibs with different purposes. (I guess it's my systems
engineering background coming through here. :-)
Regarding collection classes, I did an extensive subclass of
NSMutableArray -- although on hindsight, most of it could have been (and
may still be) done as a category.
> We need someone else who knows more about these things than me to
> chime in, but...
>
> On 2008 Jan, 09, at 19:52, Gordon Apple wrote:
>
>> Sketch uses property list serialization rather than encodeWithCoder,
>> encodeObject:forKey:, etc. Is there any particular advantage/
>> disadvantage
>> to this? Don't they ultimately do the same thing? If it is to set
>> up all
>> the KVOs, couldn't the same thing be done either way?
>
> I thought that the Sketch example code was depracated several years
> ago and replaced with Sketch-112. But I see that it is still in
> Leopard's /Developer/Examples/AppKit/. Maybe someone who knows can
> please set us straight on which is the latest "Sketch" we should be
> using??
>
>> I should mention that I use only one type of graphic object class for
>> everything, differentiated only by the content of a properties
>> dictionary.
>> (In fact, now that I've done it, I don't know why I didn't just make
>> that
>> class a subclass of NSMutableDictionary.)
>
> I can't find the reference now, but I seem to remember that
> subclassing Cocoa's Collection classing is highly discouraged and
> leads to trouble. So, the reason why you didn't subclass
> NSMutableDictionary is that you apparently have excellent intuition.
_______________________________________________
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