JavaFX: Does it have a place in your modern tech stack?


When I first started at university I was talking to some 2nd and 3rd-year students and, once I mentioned that I would be doing "Applications Programming" they laughed. The primary reason for this they explained was that most of the subject was built around learning how to program a GUI application using the beloved JavaFX.

As the semester has progressed, I've found myself enjoying the 2nd programming subject for future software engineers less and less. Among some of the other issues, the use of JavaFX stands out the most.

For a bit of background, the university's pathway for anyone that needs to do software as part of their degree means learning both Python and Java with other languages being taught as required like "Fundamentals of C", a subject that most students take in their second or third year.

Now, back to JavaFX.

I believe JavaFX was chosen for building user interfaces because the course's prerequisite subjects only taught two languages; python and java. But arguably if you were to try and teach UI design in the modern age you might begin with teaching students HTML, CSS and JavaScript instead of FXML, FXCSS and Java. Where, for the most part, JavaFx is borrowing features anyway.

If you were to inspect a compiled and packaged JavaFX file you would see that the output contains generated HTML files for each of the views in combination with a java file for interacting with the system. To someone who's looked at building desktop applications, this seems similar in some aspects to the Electron framework. But instead of using NodeJS for the backend Java is used.

What annoys me about this approach is not the Java aspect but instead how the windows are designed with FXML and JavaFX's botched version of CSS which is missing some of the more modern features. So, why use JavaFX when more modern and up-to-date alternatives are available?

The simple answer is that it's easy.

Rather than teach students an entirely new and futureproof way of thinking the subject wants to teach students a forgotten framework for a language that students already know.

In searching for a job that caters to people who know JavaFX I came across only two listings. One is for a company that wants a Senior Java Engineer to build a React/NextJS JavaScript app (seems weird) and the other seems legitimate but focuses mainly on using JavaScript-based frameworks like Angular and React.

To conclude, if you need to give your existing Java codebase a UI then sure, go for JavaFX. But, if you don't have an existing codebase then take the time to learn HTML, CSS and JavaScript as it will serve you well in the future as it continues to evolve (where I would argue JavaFX has stagnated).