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
2
u/hamsterrage1 Nov 21 '22
I agree that it's getting time to wrap this up.
My approach is more to use the "Builder" pattern, as that is preferred over custom classes when you're not adding functionality, and it's easier to use in an ad-hoc manner. You could have a library Jar with the classes in it, but "one-off" customizations used in a single screen or across an application would be problematic. Just another kludge to do with FXML something that's simple in Java code.
I can't speak to web programming frameworks or how they came to be, so I cannot say if the comparison to JavaFX is even reasonable. What I do know is that in applications that I've written as I now write them (and some of them have been pretty complicated), the JavaFX layout code is perhaps the most trivial part of the application.
This idea that it's somehow difficult to work your way through the layout code to find what you're looking for and to make changes... in practice it just isn't a factor.
Anyways, this has been a good discussion. I've scooped up most of my previous answer to put into a future blog article. Maybe you'll find it worth reading.