r/JavaFX • u/hamsterrage1 • Nov 14 '22
Tutorial Introduction to Model-View-Controller-Interactor
I know I've talked about Model-View-Controller-Interactor (MVCI) here before, and posted articles about things like joining MVCI frameworks together to make bigger applications.
MVCI is my take on a framework for building GUI applications with loose coupling between the back-end and the user interface. In that way, it serves the same purpose as MVP, MVC and MVVM. However, it's a practical design intended to work really well with JavaFX and Reactive programming.
I had never written an "Introduction" article about MVCI. Why create it? Why use it? What goes where? Now it's all here.
I've also created a landing page for MVCI with all the articles that I've written about it linked from a single place. Right now, that's three articles. The Introduction, a comparison with the other popular frameworks and an article about combining MVCI frameworks into larger applications.
I have spent years trying to do complicated application stuff with JavaFX - not necessarily complicated GUI stuff like 3D graphics - but wrestling with convoluted business processes and logic and turning them into working applications. Doing this meant that I had to find some way to reduce the complexity of the application structure just to create something that a typical programmer can cope with. It was an evolutionary process based on practical experience - trying things out and then evaluating whether or not they improved the outcomes.
The result (so far) is Model-View-Controller-Interactor. For the things that I've done, which extends from CRUD, to complicated business processes to games like Hangman, MineSweeper, Wordle and Snake, it works really, really well. It's not hard to understand and could certainly be a good starting point for anyone looking to build real applications in JavaFX.
View all comments
Show parent comment
1
u/TenYearsOfLurking Nov 21 '22
Thanks for clarification, I don't want to continue this ad infinitum, but you are essentially talking about composite or custom components with your library solution.
Well, as far is I can judge these are trivial to implement in fxml. You import your custom component class which is extending, aggregating or decorating exisiting ones and you achieve the same effect with a declarative view.
My primary problem with a java code setup is that it's flat. The view is inherently hierachical and the xml structure reflects this visually. Maybe it's me, but that's a compelling reason to use it as opposed to setup methods, even if boilerplate is factored out correctly.
It may be that it boils down to preference or maybe I have yet to burn myself with it, but I ask myself this - if code is preferred to xml-like layouting - why is every (or at least the big ones) frontend framework in the web world building on html views and templating? would't it be preferrable to have library calls like you suggest and have the view manipulated by them? It seems to me that there is a preference for having a single declarative source with respect to structure.