Nowadays, when you hear someone say…
Lean. Elegant. Concise.
…are they describing a laconic supermodel or a freaking computer language? Your guess is as good as mine.
All of the above stand in stark contrast to what Java is considered to be: verbose and inelegant, the enterprise’s choice, the boring-professor-in-a-tweed-jacket of coding.
But wait a moment: why is a verbose language automatically inelegant? Why is being concise such an advantage?
When I hear that “you don’t have to use semicolons in Kotlin / Go / whatever” uttered with such excitement and relief, I am astonished. Semicolons are a problem now? Were they ever a problem?
Removing semicolons from Go means that you have to place the opening curly brace on the same line as the if- / for- / whatever- statement, otherwise the compiler loses its shit. I’m OK with it (that’s how I roll anyway) but imagine that you’re a person that’s anal about the placement of their curly braces and that you prefer to place the opening brace on the next line of the statement. Nuh-uh, can’t have it that way but, hey, no semicolons, amirite?
And you know what? I like semicolons. I enjoy hitting the semicolon button hard after having written a nice line of code. For some reason, dopamine is released and feels are felt. Who are you to take my semicolons away?
Fuck it, I’ll make this entire article about semicolons. I already have an asshole-related title ready anyway.
I hate pretentiousness and bandwagon-jumping as much as the next guy. No, more than the next guy and the guy next to him and the guy who is next to that guy. I could keep going, but this is already getting confusing.
This new-fangled fascination with the omission of semicolons reminds me a bit of the music business. How so? It’s bandwagon-jumping at its finest.
Anyone old enough to remember the last brontosaurus on Earth will most likely also remember The Beach Boys.
Full disclosure: The Beach Boys are my favorite band ever.
When The Beach Boys were just starting out, they were a musically unimpressive band with some great vocal harmonies. After having a string of surfing-related hits, Brian Wilson (their leader and principal songwriter) started getting more and more ambitious with his songwriting and production techniques until The Beach Boys released their magnum opus, “Pet Sounds”.
“Pet Sounds” was celebrated as one of the best albums ever recorded at the time but didn’t really sell as well as their previous albums. Brian Wilson didn’t care, though: he set off to create an even more ambitious album called “Smile”, which The Beach Boys never got to release, partly because Brian Wilson went nuts.
A couple of years after the non-release of “Smile”, The Beach Boys were deemed irrelevant by the tastemakers du jour. They kept releasing album after album of pretty great songs but nobody cared anymore. Not because the albums were bad but because everybody had decided that The Beach Boys weren’t hip enough.
While this story has a happy ending (Brian Wilson is sorta functional again and SMiLE got released to huge praise), it illustrates the power of the tastemaker. The person that decides whether something is good or bad — and gets almost everybody else on the bandwagon.
Let me ask you something: in an alternate timeline in which C or C++ or Java don’t have semicolons and then Kotlin comes along and adds them, wouldn’t there be some people who would state how “elegantly” semicolons declare where a statement ends and another one begins, even if they are on the same line? While no-one can answer that question for sure (expect for Walter Bishop, probably), I’m pretty confident that yes, that would be the case.
And another thing: if the average person types about 200 characters per minute , that means that they type 3.3 characters every second. Which means that it takes about 300ms for the average typist to insert a semicolon, which would go down to about 200ms for a coder. That means that it takes about a fifth of a second for someone to enter a semicolon.
That’s not even enough time for me to slap you across your stupid-ass, semicolon-hating face.
Boy, think about all the time you’ll be saving!
And everybody knows that it’s the typing that takes up most of the time in coding, not planning and testing the flow, architecture and algorithms, right? Right?
Secondly, even if I did go off the rails because I got mad, I was merely using semicolons as a metaphor for the tyranny of the tastemakers. You know what else they don’t like in Java? The “new” operator. As if
Animal animal = new Animal();
is so much worse than
val animal = Animal()
As if losing the “new” keyword is going to somehow make me crazy-productive, discounting all the time I’ll have to put into learning Kotlin in the first place.
Oh, yeah, glad I mentioned that — is there any study performed that shows that the time you save by learning (and using) Kotlin is more than the time you’ll have to put in to learn Kotlin in the first place? Didn’t think so.
And how about all the edge cases you’ll have to deal with when you’re a Kotlin beginner? All those edge cases you have already learned how to deal with in Java, through years of blood, sweat and tears? (hey, it rhymes!)
Look, this is not a hit piece on Kotlin or Go or whatever. I actually enjoyed learning Kotlin and (a bit of) Go. I enjoy creating extension functions and I get their value. I like being able to return multiple values from the same function. It’s cool to have default argument values. I’m not denying any of that.
However, I am a bit bothered by this “Kotlin or you’re stuck in the past” sentiment that’s so pervasive throughout the Android community.
For now, I prefer using Java and I think that, for as long as the official Android docs are using Java as their language of choice, it’d be misleading (especially to beginners) to pretend that choosing Kotlin is the smart (or, even worse, only viable) way to go.
So let’s add some padding to this echo chamber and kill the reflections before the feedback gets deafening for once.
Made with Java: our location-based photo request app, Looxie!
We also made a license plate-based communication app called Karkoona. No Kotlin to be found in there either.
Create your free account to unlock your custom reading experience.