Paul Clapham wrote:
Based on my Swing experience, it's damn hard to separate the view and controller logic. From the very beginning of coding you find that if you click on a button then it usually changes the rest of the view, and you really have to put on your Separation of Concerns uniform and march around the room before you can put that code into a separate controller tier. I've seen quite a bit of Swing code in web tutorials and that never happens there.
Yeah it's tough sometimes. I just try to do the best I can to keep things that don't really need to be in those JFX controllers in their own space. JavaFX sort of forces the issue by calling these "Controllers" (it's even built into the the FXML spec), but I try to keep what's in there limited to things that need direct access to UI components as much as practical/feasible.
Notably I believe this lack of separation between view and logic is why people decided long ago that Java UIs suck. No, many of the Java UI devs back when Swing was big just messed up, by putting long running
logic stuff in the Event Dispatch
Thread, freezing up the UI. JavaFX also has an "EDT" of its own, so it's subject to the same potential poor experience. I don't think the OP has any long-running operations planned in this case though, so hopefully staying on the JFX thread will be fine.