- Published on
My dream (backend) programming language does not exist (yet)
- Authors
- Name
- Seb
Since I started coding, I constantly try to be more efficient and build better systems.
This lead me to explore many languages, evaluating their strength and weaknesses, in the ultimate quest to find the perfect one.
I mostly work on the Backend, and when I do Frontend, there's not really much choice other than Javascript anyway. That is why this article will mostly focus on Backend
Wishlist
Here is my list of features I would like to see supported in my dream programming language:
- Static Typing just makes building and maintaining large software projects much easier. It results in much better support for linters, increasing speed of development. A certain class of bugs (type related) can be entirely avoided. Refactoring becomes much safer. Some languages (e.g. Kotlin) even support null safety which eliminates another subset of possible bugs before even testing or running the code.
- Vast and stable ecosystem to help not to re-invent the wheel. When working on projects, I like to focus on solving the core of the problem. Any (mature) existing library will help the cause. The Ecosystem should be stable though, with few breaking changes in new versions.
- Expressiveness is important to write concise and maintainable code. Features like generics and lambda functions help us to write beautiful code.
- Machine Code Compilation is a great feature to create compact, portable and performant software.
- Concurrency Support beyond simple threading (like Go's goroutines or Kotlin's coroutines) is something that can be extremely valuable in certain scenarios.
- Performance is important, but in my opinion often overrated. In my experience, there are very few projects that have the scale to actually cause the programming language to make a difference. More significant than raw performance is often memory consumption.
The journey
When I first started coding, I chose Python for the ease of getting started. Being a coding noob, I still managed to create some working software, but eventually struggled to maintain it. The dynamic typing made refactoring was a nightmare, and runtime bugs were common.
I then later got introduced to C# in my first job in Singapore. I since became an advocate for static typing. However, C# at the time (before .net core) was deeply coupled to the Windows ecosystem, with all its ugly sides, and the inevitable lock-in. The library ecosystem is (was?) not very great also. However, the language itself, at least at the time, was feature-wise superior to all others.
I moved on to explore Java, which at the time felt like a lesser C#, but Java being open-source and portable between platforms made up for the lack of features. Still, what bothered me about Java was the complex (yet stable) ecosystem, with the JVM and various competing build systems (ant, maven, gradle). Also, JAVA syntax itself was not the greatest back then (e.g. lack of type inference when defining variables like String name = "Bob"
).
At that time, the latest craze was Google's new Golang, and I felt very excited by the promises of performance, simple machine code compilation, language backwards compatibility and a quickly growing ecosystem. I coded some projects in Go, and eventually realized that the main issue with Go was expressiveness. The lack of complex languages features like generics and lambdas, or immutable variables, leads to ugly, hard to read and ultimately hard to maintain code. E.g. the highest rated answer for reverting a list in Go on stackoverflow is not what I would consider nice code:
// revert list
s := []int{3, 5, 6, 1, 2, 7, 9, 1, 3, 5, 3, 8, 10}
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
s[i], s[j] = s[j], s[i]
}
After I heard that one of my friends was using Kotlin, a new Java flavor, in a large project in one of Singapore's biggest bank, I wanted to try it out. And I really started to love it. In my opinion, Kotlin currently has the best match to all the features in my wishlist above. It has static typing (even with null safety and immutable variables), a vast and stable ecosystem (you can use Java libraries in Kotlin), great (yet complex) concurrency support, and running on the JVM, it is fast enough for 99% of applications. On top of that, it is extremely expressive with its support of lambdas, extension functions and some more cool functional programming support. It also has a great amount of built-in helpers! Here's how to revert a list of numbers, filter out odd numbers, sort it and get the first 3 elements:
// filter out odd numbers, remove duplicates, revert it and get the first 3 elements
val numbers = listOf(3, 5, 6, 1, 2, 7, 9, 1, 3, 5, 3, 8, 10)
val result = numbers
.filter { n -> n % 2 == 0 }
.distinct()
.reversed()
.take(3)
Beautiful! Note how numbers
cannot be re-assigned, as it is immutable. A great feature that prevents bugs in complex applications. And these list helpers also work with complex objects.
IDE support in IntelliJ IDEA is excellent. Type hinting and refactoring are working extremely well.
However, Kotlin is also not perfect. It lacks Machine Code Compilation (there is Kotlin-Native, but you cannot use Kotlin or Java libraries in it), and it still has the heavy JVM and the convoluted build system.
I have also been coding on and off with the inevitable Javascript, in particular since Typescript was released. It is a love-hate relationship. The community seems to be always on the forefront of cool new stuff, and for Frontend development, there's no other options really. However, the lack of real static typing and compilation is a turn-off. But the worst, without doubt, is the constantly changing, extremely unstable and insecure ecosystem. I like to write some React on the Frontend once in a while, but for the Backend, I prefer something more serious and stable.
What's next?
There are a few other contenders that I want to try:
- Elixir
- no static typing but it is a functional programming language
- concurrency is a core concept of the language
- .net core
- Should have most of the features I want, but does it have a great ecosystem?
- V
- On paper, it has everything, but it is very immature, and is mostly developed by a single developer
Conclusion
For now, Kotlin is my go-to languages of choice. It has been great to work with it so far. Great expressiveness, a stable ecosystem and great concurrency support have convinced me.
Nevertheless, I will keep my eyes open for the ultimate dream language 😊