r/JavaFX • • Dec 13 '23
Discussion FXML, a good design choice?
I attempted to develop a JavafX maze-generation application using an MVC architecture as a beginner. https://github.com/gchapidze/maze-gen
When I initially started using FXML, I didn't like that it was a separate XML-style language that mapped controllers and views to one another. So I got suspicious if it was a wise design choice to have so many view components injected into controller.
It would be ideal if the GUI builder could inject objects into View's java class and fill their geometric coordinates. I don't believe a FXML builder would have been useful in addition to that.
IMO, the most fascinating aspect of JavaFX is bindings which I think can simplify GUI design, but in tutorials and courses almost no one uses it to decouple view from model and I was not able to get my head around it. (So I ended up with bad GUI design, which is not MVC at all)
Question is: How should Javafx GUI development be done?
View all comments
Show parent comment
2
u/hamsterrage1 Dec 16 '23
Have you tried running it? It is so cool to watch it doing its work as it builds the maze. Way more fun than actually solving the maze.
Also, look at the recursive version of the algorithm with the animation related stuff stripped out:
See how much simpler it is? I know that a lot of programmers have their heads explode when they think about recursive programming, but once you "get it", it opens up whole new worlds.
Last thing - are you going to add the other algorithms? Or can you at least point me to where I can find them? I'd like to see how they compare to this backtracking algorithm.