Skip navigation.
 
mlRe: Property List Serialization in Sketch
FROM : Gordon Apple
DATE : Thu Jan 10 20:13:29 2008

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.

Related mailsAuthorDate
mlProperty List Serialization in Sketch Gordon Apple Jan 10, 04:52
mlRe: Property List Serialization in Sketch Jerry Krinock Jan 10, 06:03
mlRe: Property List Serialization in Sketch Jean-Daniel Dupas Jan 10, 10:30
mlRe: Property List Serialization in Sketch Gordon Apple Jan 10, 19:25
mlRe: Property List Serialization in Sketch Gordon Apple Jan 10, 20:13