Well I'm writing Java again
Yes, after well… many years of managing to now write java I’m back to chugging out classes like they are the best things since sliced bread.
How did I get here? Why am I here? What am I really doing with my life? All good questions.
Writing a cross platform application
So, let’s start from the beginning. I like collecting books, I have a somewhat respectable library which is growing to my partners dismay. My love of books comes from my father who has an even larger collection. One thing that we are both bad at is inventorying what we have, something that is a very good thing to do.
So since I’m a programmer I said to myself: “Hey I could easily write a program that would handle our collections”. Now, you might think to yourself. “You know that there are such programs”, “Have you heard of spreadsheets???” and other logical thoughts. Yes, I certainly know all of this. But I like to have fun and programming and creating software for yourself and your own needs is really fun. So get of my back M’kay?
So I have a goal. Write an application for myself and my ehhm.. less than technically savvy father, who of course uses windows while I’m sticking to fedora. Right, a cross platform application in 2021, how hard can it be?
What should you write GUIs in?
Like most of the known world I’m interested in learning Rust. So my first idea was to write something in Rust. What options do we have? Well there are a bunch of options here! Most are of course on version 0.x and unstable. That could be fine of course but I really don’t want to get stuck rewriting a bunch of stuff since an unstable API changed. There are also bindings for GTK and QT. I went first the QT route and boy…there is a lot to wrap your head around. Now that is not inherently bad but the documentation is not super great and I found myself get stuck more often than I would like to be for this small little application, I also just kept getting crashes with the GTK design tool glade, it would just randomly crash sometimes.
A quick glance towards QT made me just not want to try it. Perhaps it is better but the QT website just wants to sell me something and I’m not sure I want to buy it. Although I should say that if I felt I had a larger amount of time to learn QT is the route to go.
Hey what about electron?
Electron was the next option. Now, with electron I could probably get a beta version to work quite well in a weekend. The problem with electron is of course the amount of resources that it hogs. My father does not have a particularly powerful laptop and I really don’t want to play IT support more than I already do by bogging down his computer.
So electron was kinda out just because of that.
It is now that I’m somewhat unhappy with life of not finding any satisfactory. It then hit me like a ton of not garbage collected objects. JAVA.
Java to the rescue?
Java does have a somewhat easy GUI framework built in with swing. There is also the JavaFX library which is a bit more modern (but rumors have it that the IntelliJ suite of editors are written in swing so you do not need modernness). Java is also for these types of trivial applications very good at being completely cross platform with ease. All my dad needs is the java runtime, which he most likely already have and it will just work!
So here I am. Sitting writing java again for the first time since 2015 because it is probably the best thing out there if you are looking to write cross platform desktop applications. I’m not happy, but at least I’m getting stuff done.