[Drawkit] [self selectedAvailableObjects] empty!??

James Maxwell jbmaxwell at rubato-music.com
Thu Jul 17 22:26:31 PDT 2008


ah, I see... Adding instance variables... That's a good rule of thumb.  
Thanks!

I'll look into categories, then. Mind you, I did override a few  
things, as well. Notably, the moveUp/moveDown. In music, of course,  
"snapping" on the time axis is different from snapping on the pitch  
axis. My grid is sort of like manuscript paper, and all y-axis  
snapping keeps note objects locked to lines and spaces, while the x- 
axis snapping can help place things on a "quantized" musical grid. It  
may seem a bit lazy, but it's actually very convenient having a fixed  
music paper-like basis for everything. I can easily get the staff  
number of any note, and determine the pitch, figure in whatever clef  
precedes it, and so on. It all works quite nicely.

cheers,

J.


On 17-Jul-08, at 8:59 PM, Graham Cox wrote:

> Hi James,
>
> There's a quite a simple rule to use to determine if you need a  
> subclass or a category:
>
> If you need to add more data to an object (more instance variables)  
> then subclass. If you only need to add methods, make a category.
>
> I don't know if this is the same as anything in Java - I'm not at  
> all familiar with it. It's not something you can do in C++ either,  
> so as far as I know it may be unique to Objective-C. But it's  
> incredibly useful. It avoids the need to subclass just to add a  
> method or two that the original writer "forgot" or for a need that  
> wasn't anticipated in the design of the object, or just to make  
> common operations quicker and easier (by calling several existing  
> methods in a common sequence, say). For framework creators like me,  
> it's fantastic because it means that I don't have to try and  
> anticipate everyone's needs to the last degree.
>
> cheers, Graham
>
>
> On 18 Jul 2008, at 1:39 pm, James Maxwell wrote:
>
>> My subclass of DKObjectDrawingLayer does a few things, some  
>> concerning selections, others concerning my "musical grid". I  
>> couldn't see any direct way of doing what I needed to do, other  
>> than subclassing, and it seems to be okay, for the moment... To be  
>> honest, I don't really know anything about categories. I'm thinking  
>> they're a bit like Interfaces in Java, but I don't really know.
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net



More information about the Drawkit mailing list