[REVIEW] Make controller instantiation customizable

Richard Bair Richard.Bair at oracle.com
Fri Dec 16 17:17:05 PST 2011

>> That's what I was thinking too. If the <param> approach turns out to be taken, then in many ways the ControllerFactory becomes less important because for all those custom dependency injection sort of scenarios, you can actually just use the <param> approach instead (and probably would?).
> Maybe. I actually really like the current design and the concept of the controller as the "code behind" the document. It's simple and easy to understand, and addresses most of the use cases I imagine I'd personally want to address as an app developer. Combined with the controller factory, there are quite a few possibilities. The param idea is certainly worth exploring though.

I think for what it does the current design is very nice. But we've had Roman, Adam Bien, Dan and myself all make reference to wanting to use other patterns and for those, the fx:controller and "code behind" concepts are just not what we're looking for, even with a ControllerFactory (although that does certainly help!). Do you remember before 2.0 when Eamonn and I both wanted to invert the control and have the Controller create the FXML file rather than the other way around as we do now? We were thwarted due to the fx:include problem. But with <param> we might have a more powerful, and I think more elegant, way to address that issue without having the FXMLLoader to create the controller.

>> But ControllerFactory isn't painful, especially if it is just a Callback ;-)
> I will refrain from comment on this.  :-)

Well, at some point if this API is ever going to be approved we'll need to break the impasse :-). It is true there are some inconsistencies in the platform (with all the API we've got and the number of unique developers building it, its amazing it is as consistent as it is!). And although I completely get the desire to have a specific SAM interface in this case and that it would be consistent with BuilderFactory, it would be inconsistent with the rest of the platform and introduce a new type which very few people will care to know about. I think it is important that we strive for consistency with the rest of the platform and let BuilderFactory be the outlier rather than both BuilderFactory and ControllerFactory.


More information about the openjfx-dev mailing list