gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ivars in GUI classes


From: Richard Frith-Macdonald
Subject: Re: Ivars in GUI classes
Date: Tue, 21 Aug 2007 06:39:30 +0100


On 17 Aug 2007, at 03:41, Chris Farber wrote:

Hello everyone,

I'm beginning to add bindings to the classes listed here:
http://developer.apple.com/documentation/Cocoa/Reference/ CocoaBindingsRef/index.html#//apple_ref/doc/uid/10000189i

In order to add a binding, a few pieces of information have to be kept track of, such as the value transformer, bound object and key path, and other options. One way to do this would be to add instance variables to the classes, but I am not sure if there would be any negative consequences of this. If you look at the headers on Mac OS X, it appears this is not the route Apple took. Alternatively I could put these in global map tables or dictionaries and use locks to make it thread-safe, but this would be a lot more work (and potentially slower?).

I'd appreciate any advice on which route to take.

I'd use the external map tables rather than instance variables.

Yes, it's a bit more complex (but it avoids clutter in the individual class headers) and a bit slower (probably negligible in the context of all the other code involved in bindings).

Keeping the info in private external tables means:
The implementation is hidden, so changes can be made between different releases of the library without causing binary incompatibility. The code can all be in one place, so it's easier to see it all and maintain it.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]