The beauty of simplicity in programming


Kotlin is an amazing programming language. I’ve been using it to code all my hobby projects for close to 4 years now, and after all this time I would only change 2 or 3 small things that mildly annoy me about its language design.

However, hearing about the new Jai programming language and the reasonings behind its inception (explained by the creator Jon Blow in some very interesting videos and conferences), really got me thinking about the value - and beauty - of simplicity in programming.

I love Kotlin, but damn is it complex

Kotlin is what I’d call a really complex language. It’s one of these modern programming languages that can do - or try to do - just about everything.

They are object oriented, but also functional (because it’s trendy). But with most of them you could also theoreticallly do some procedural style programming.

You can use Kotlin for desktop apps, but also Android applications… Oh, and now maybe you can use Kotlin for the web too. And I guess then there’s also Kotlin native.

Furthermore, Kotlin is a very malleable programming language. You can take advantage of some of its more advanced features and turn the syntax into something more akin to markup languages:

fun result() =
    html {
        head {
            title {+"XML encoding with Kotlin"}
        }
        body {
            h1 {+"XML encoding with Kotlin"}
            p  {+"this format can be used as an alternative markup to XML"}

            // an element with attributes and text content
            a(href = "https://kotlinlang.org") {+"Kotlin"}

            // mixed content
            p {
                +"This is some"
                b {+"mixed"}
                +"text. For more see the"
                a(href = "https://kotlinlang.org") {+"Kotlin"}
                +"project"
            }
            p {+"some text"}

            // content generated by
            p {
                for (arg in args)
                    +arg
            }
        }
    }

The Kotlin docs site from where I extracted this code snippet states:

This is completely legitimate Kotlin code.

“Yes, you may not believe it, but it’s actual Kotlin code.”

But is it really a good practice to reach such limits with a programming language?

All of these options give the programmer a lot of control. I used many of Kotlin’s advanced features in my own game projects, and while they worked really well, sometimes I wonder if I’d be a happier programmer had I used a simpler language, with simpler features, that resulted in a simpler and more straightforward codebase.

The programmer’s journey

For the last 4 or 5 years I’ve been through the start of a programmer’s journey.

At the very start, you just focus on learning the syntax and the basics.

Later on, you start to learn about the good and bad practices. As it turns out, there’s a lot of design and architecture work behind every codebase.

I learned about design patterns, and popular books like Clean Code.

I learned what kind of languages are generally more hated, and which ones are loved.

Eventually, I formed my own opinions. I seem to gravitate towards simplicity. I loathe the over-engineering encouraged by enterprise coding practices. I don’t like 99% of the advice exposed in the famous Clean Code book (luckily, it seems that I am not alone in this).

The beauty of simple code

I see beauty in simple code. I love the feeling of writing your first lines of code when starting a project, before everything turns into a complex and unreadable mess.

And suddenly, I am starting to feel attracted to simpler languages like C or Jai.

I look forward to the day Jai releases, but I will probably still go back to Kotlin. After all, the complexity it introduces is still optional, and its language design does focus on reducing boilerplate and redundancy.

It’s up to the developer to not use too many of the advanced features, that are probably unnecessary.

"With great power comes great responsibility."

Thanks for reading!

-->