Linux Application Development
Programming CODAv, my first native desktop Linux application.
Being a recent Linux switcher I wanted to have a look at Linux desktop application development. It has been ages since I worked on a GUI application and since I wrote Windows and macOS applications in the past it was time to try the Linux side.
The App
When my colleagues kept asking to verify the transactions included in the CODA files they are sending to the bank I knew what to build: a CODA viewer! It only needs to parse an XML file and show the transactions in a tabular format. A CODA or “XML message for Credit Transfer Initiation” (ISO 20022 XML) file encodes European credit transfers (SEPA) in a standard way. It defines the movement of funds from the debtor account to a creditor.
A little web app would probably have been more useful (cross-platform, no installation) and easier to build given my background as a web developer, but where is the fun in that?
The application would be known as CODAv, for CODA viewer. It can be downloaded from the snap store or you can build it from source.
The Toolset
In my Windows days, I used Visual Basic with Visual Studio, on macOS it was Xcode with Objective-C, on Linux it is…? Linux being Linux there isn’t a go-to "this is how you build a Linux application" solution, there are many.
The most common choices seem to be a C or C++ application with GTK+ or Qt for the graphical part. Then there are the higher level languages like Python or Go using GTK+ or Qt bindings and finally, you have Electron.
Electron is the new kid on the block and great for cross-platform applications but it feels too similar to web development and I wanted to get out of my comfort zone. Ruby with GTK+ or Qt would have been the most logical choice but most Linuxy people seem to prefer Python over Ruby so that didn’t feel like the “right” combination. Back to C or C++ then?
It’s remarkably hard to find good getting started with Linux development tutorials, except for elementary OS’ splendid “Getting Started” tutorial, a refreshing find! They use Vala, which generates C code, and is tightly coupled with GTK+. That concluded my quest: Vala with GTK+ it is.
The Lessons
- Vala is a nice language but I can’t get rid of the CoffeeScript feeling: don’t learn CoffeeScript if you hate to learn JavaScript, use CoffeeScript after you learned how JavaScript works. The same feels true here: I used Vala so I didn’t have to think about C. You quickly get stuck when the C parts shine through. Vala is also a niche language, mainly used for elementary OS and some GNOME apps, so it’s hard to find documentation (outside of the Valadoc site). I did manage to compile the application on macOS though, without a single code change. I did not expect that.
- The build tools are weird coming from web development. I used autotools and cmake, both powerful tools, and it felt good to finally understand the “configure, make, make install” magic, but they aren’t fun to use. It’s probably a lack of experience, but I am constantly fighting to understand Makefiles.
- I never built a deb or rpm package and went directly to snaps to package the application. Time well spent. Snap packages are probably the most exciting development in the Linux desktop space at the moment (as are Flatpacks, but I didn’t have a look at those yet).