[REVIEW] Make controller instantiation customizable

Tom Schindl tom.schindl at bestsolution.at
Tue Dec 13 15:57:21 PST 2011


Am 14.12.11 00:50, schrieb Richard Bair:
> 
> On Dec 13, 2011, at 3:40 PM, Daniel Zwolenski wrote:
> 
>> On Wed, Dec 14, 2011 at 10:00 AM, Tom Schindl
>> <tom.schindl at bestsolution.at>wrote:
>>
>>> Am 13.12.11 23:58, schrieb Tom Schindl:
>>>> Am 13.12.11 22:53, schrieb Richard Bair:
>>>>>>> and 2) the developer chooses to forgo tool support and instead uses a
>>> 'name' as the controller attribute in the FXML - this name could then be
>>> used to lookup the controller in a DI factory/module (this allows for
>>> multiple instances of the same controller class to be used, just configured
>>> differently, which is not supported in the proposed mechanism).
>>>>>>
>>>>>> Seems like it might be an edge case (i.e. falls into the "10% case"
>>> vs. the "90%" case").
>>>>>
>>>>> I'm not sure, all it takes is one popular framework that wants to make
>>> use of it and it becomes a 90% case :-). I think with the DI frameworks,
>>> having a named lookup is probably pretty common?
>>>>>
>>>>
>>>> Now the correct reply to the correct mail. I'm using DI a lot but rarely
>>>> use named things but I'd say 90% of the time I'm going with the
>>>> interface name as the identifier so the Class-Object is fine at least
>>>> for my DI uses cases.
>>>>
>>>
>>> And for one who tries to write FXML-Tooling a simple key is a nightmare
>>> e.g. to provide you with event callback proposals/validation, ... .
>>
>>
>> True, and I agree with all of the above (except the stats of 10%, I suspect
>> much higher - named look ups exist as key concepts in DI exactly because of
>> the limitations of the more convenient but less flexible/powerful class
>> based lookups).
>>
>> BUT we *can* support the (supposedly) 10% case without doing any damage to
>> the 90% case giving us 100% support! :)  i.e. doing the String approach
>> doesn't cause anyone any problems and makes everyone able to achieve their
>> goals: it is the more generic solution.
> 

What about the factory looking like this:

ControllerFactory {
  public <O> create(Class<O> type, String data);
}

And one could define a controller like this:

fx:controller="MyController:blabla"

This would make the tooling builders like me happy and provide you the
flexebility to do the look up using a key.

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


More information about the openjfx-dev mailing list