*PropertyBase vs Simple*Property
Tom Schindl
tom.schindl at bestsolution.at
Thu Jan 10 08:30:45 PST 2013
Hi,
Going through the codebase I see both patterns used to achieve the
invalidation handling (even in the same fx-component (e.g. control)).
In other areas it might make sense to have an inner class and create
instances of it instead of creating n-inner class instances (e.g.
EventHandler).
Is the Java8 plan still there if not should the current Simple*Property
subclasses who overload invalidated be changed to PropertyBase?
Tom
Am 01.12.12 15:49, schrieb Richard Bair:
> Hi Tom,
>
> The tradeoff between Simple* and *PropertyBase is dynamic vs. static footprint (heap size vs. class size). The Simple* guys have references to the bean & property name, and so require additional heap space to store this data, whereas the *PropertyBase guys don't, but require a subclass to override the getBean() & getName() methods. Generally we should be using the Simple* guys, unless we already had to override the property for the sake of the invalidated() method. In that case, since we're already paying the static footprint cost, it makes sense to use the *PropertyBase instead and save on dynamic footprint.
>
> With Lambda's, I was hoping to be able to extend the Simple* property implementations to also take a lambda to a method which represents the invalidated method. In this case, we could remove most of the anonymous sub classes, and make quite an impact on our static footprint (at the cost of making each object a little heavier in memory).
>
> Richard
>
> On Dec 1, 2012, at 5:58 AM, Tom Schindl <tom.schindl at bestsolution.at> wrote:
>
>> Hi,
>>
>> I'm just working on a patch for a control and I'm so I'm browsing
>> through the code a bit and find there all of the pattern that you are
>> creating an instance of *PropertyBase for all stuff instead of using the
>> Simple.... , which creates a whole lot of new $1,$2,$.... class files.
>>
>> Would it be from a size point of view better to create an instance of
>> Simple*Property? I guess there's a reason but I'm not sure I know which
>> one it is. Could it be garbage collection - property points to Bean and
>> Bean points to property?
>>
>> If this the reason I think anyone who use uses Simple*Property has the
>> same problem and the right fix would be to store the bean instance in
>> Simple*Property in a WeakReference?
>>
>> Tom
>>
>> --
>> B e s t S o l u t i o n . a t EDV Systemhaus GmbH
>> ------------------------------------------------------------------------
>> tom schindl geschäftsführer/CEO
>> ------------------------------------------------------------------------
>> eduard-bodem-gasse 5-7/1 A-6020 innsbruck fax ++43 512 935833
>> http://www.BestSolution.at phone ++43 512 935834
>
--
B e s t S o l u t i o n . a t EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl geschäftsführer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5-7/1 A-6020 innsbruck fax ++43 512 935833
http://www.BestSolution.at phone ++43 512 935834
More information about the openjfx-dev
mailing list