Comparing Backend Frameworks written in Java, Swift and Go
This article compares the backend frameworks Spring (Java), Vapor (Swift) and Gin (Go) in regards to ease of use, portability and flexibility. For that, I wrote the same RESTful micro-service using those three frameworks / languages. I will cover a bit of the languages’ look and feel, their development environment and show some sample code of handlers and ORMs. Last but not least, there will be a section on inversion of control in each of the frameworks. But first, let me give you a quick introduction…
I like Java…except for all the bulk it has collected in the past 24 years…and its lack of consistency. And then there is this JVM…don’t even get me started on that one. And finally, there are those frameworks…those frameworks that make me wonder wether I’m studying software engineering or wizardry (definitely not talking about OSGi here… #totallynoirony).
And still Java (with Spring) is the goto language for enterprise backend development. That’s no different here at comsysto.
For my part, except for educational tasks, I grew up writing everything from desktop-apps (not a very good idea) to web-servers (very good idea) in Go. Having learned to love the language’s clarity and its expressive style, the performance and lightweight dependencies, I was quite shocked when I was thrown back into the muddy waters of enterprise-style Java and its annotation-based frameworks.
Lately, I got a little into iOS development and thus started to learn Swift. Since it is a very flexible language, it can also be used for backend development, which enables you to share code between your backend and (iOS/macOS) frontend. Thus, I chose Swift as the third language for this comparison. (This is also due to Swift for Tensorflow being on the rise, which could be a way more flexible alternative to Tensorflow’s Java or Go APIs.)
tl;dr: There’s a quick recap of the whole article at the very bottom.
The languages: Java vs Swift vs Go
Let’s begin with the languages themselves and my experience working with them on the backend.
The keywords are my first measurement for this comparison, because I think their amount has a major influence on how a language feels: