Someone just showed me the “Swift is Like Kotlin” blog post. The page compares Swift and Kotlin code samples side by side, with captions, and I think the post completely missed the point of Swift.

I want to talk about how the stated design goals of each language influence the comparison, and how a syntactical comparison of the two languages is misleading. Then, I’d like to explain why Swift is more like Python than Kotlin. I’ll wrap this up with some (slightly snarky) commentary about iOS vs Android.

Before we begin, I’d like to disclaim that I’ve never looked at Kotlin before today, and it seems like an interesting language. That said, the simple syntactical comparison feels like it’s in really poor taste, so let’s start by comparing Apple and JetBrains’ stated goals and go from there. outlines several goals for Swift as a language. From the Swift homepage:

Swift makes it easy to write software that is incredibly fast and safe by design. […] For students, learning Swift has been a great introduction to modern programming concepts and best practices.

Speed, and safety from errors and crashes. There’s another stated goal that’s also worth highlighting. Swift is about expressiveness, and ease of learning.

In contrast, Kotlin’s website describes has this tag line in big letters:

Statically typed programming language for modern multiplatform applications.

Ok, that’s great. It’s a programming language for modern applications, with data types. The only thing I learn from this blurb is that has a stronger typing system than Python. (This belies the fact that Kotlin is not aimed at ease of learning, or its marketing might have emphasized that a teeny bit more.)

One of the requirements for “a great introdiction” to a language is a syntax that is easy to learn read and write. To say that Kotlin is like Swift is to say that both languages share this attribute.

The code samples demonstrate quite the opposite to me. Everything from keywords to collection declarations are geekier in Kotlin, and often harder to remember for beginners. println is a programmer-speak abbreviation for print line, whereas print is a fully spelled out verb. val is for value and let for, well, let.

As a computer science student and a self-learner, professors’ examples in C, and languages like Ruby with abbreviations galore were frustrating to understand. Swift makes a noticable and successful effort to improve in that area.

Kotlin still doesn’t seem to have array or dictionary/hashmap literal syntax, compared to Swift’s []. Which is easier? Are they “like” each other?

Another comparison is the minimum viable program in each language. Swift’s is one line: print("Hello World!"). Kotlin looks more like this:

package hello

fun main(args: Array<String>) {
    println("Hello world!")

I don’t know enough about Kotlin, but if my Java memory serves, interfaces don’t have optional functions. Adopting an interface is all-or-nothing. Swift and Objective-C both allow for protocols to declare their contents as optional for adopters.

As a final example, subclasses in Kotlin are final by default. (I mean this in the informal sense.) You need to mark a class as open for Kotlin to allow subclasses.

Kotlin is very much not like Swift these respects. Python, like Swift, is easy to learn, and might have been a better analogy. To be honest, I’m not sure what the purpose of making this comparison is.

If this post was an the vein of “Android for iOS engineers,” or “Kotlin for Swift developers” it would make more sense to me. “These are things that you’ll be familiar with.” Sure, there are valid comparisons to make between Swift and Kotlin. (For example, I spy templating in the Kotlin code sample.)

It feels like the intention was to stoke fanyboy-ish and fangirl-ish enthusiasm for Kotlin and Android. “Rah rah! Kotlin is as good as Apple’s language.” In fact, someone linked the original article at the top of Kotlin’s Wikipedia page! (Oh, while we’re here, it wasn’t an accident that Google’s Stephanie Saad Cuthberson used Steve Jobs’ famous “one more thing” formula when announcing a “new” language for Android.)

Judging by Kotlin’s first commit in 2010, Kotlin, it’s about the same age as Swift, which also began that year. Two languages, two platforms, two communities. That’s totally ok. We can retain our identities, yet still be friends.

Kotlin is like Java. Swift is like Objective-C. They’re probably both “like” C++.