The Co-Evolution of JavaScript, Swift, and Kotlin

In the 1981 I cracked open my first real book on computer programming: Apple II User’s Guide by Lon Poole with Martin McNiff and Steven Cook. I still have it sitting in my bookshelf 36 years later. Previous to the Apple II User’s Guide I was playing around programming by typing-in code from hobbyist magazines. But now I felt ready to write an original program. I had no education in Computer Science and I didn’t even own an Apple II computer. But armed with the information in the Apple II User’s Guide I knew I was going create an awesome program of my own imagination!

I read the Apple II User’s Guide from cover to cover. I highlighted passages on almost every page. It didn't help. I learned a lot about the specifics of programming an Apple II but I never did write that original program for the Apple II.

1980's BASIC was horribly hard 😱

BASIC in the 1980s was a much simpler but unforgiving language than the programming languages of today. Features programmers take for granted, like objects, classes, protocols, constants, and named functions, didn’t exist. The core features BASIC did have back then were ints or floats (but not both), strings, arrays, conditionals, loops, simple IO, and the ability to jump to any line in code by it’s number.

None of our modern tooling was available on an Apple II. Instead of an integrated development environment you had modes: immediate, editing, and running. Basic programs were written with line numbers and the line numbers were referred to in the body of the code! In the end writing and debugging BASIC code was tough. As the Apple II User’s Guide noted on page 51, “The simplest way to change a program line is to retype it.”

Looking back on it, without modern programming languages and modern tools and most importantly without the web, YouTube, and Stack Overflow, I honestly don’t know how I learned to write a real program. (But I did and how I did is a story for another time.)

In 2017 there are so many combinations of programming languages and platforms that it can seem like an O(n!) problem to sort through them all! Most engineers today need to learn JavaScript, HMTL, CSS, PHP, and SQL to program on the web, C++, Java, C#, or Go for hardcore backend services, and either Java or Objective-C to create native mobile applications. Plus it’s really important to understand a dozen UNIX commands, a few scripting languages like Python or Perl, and tools like GIT, Xcode, Unity, Visual Studio, and Android Studio. At least I seem to need to understand the essentials of all of these in order to tackle the sorts of programming challenges and opportunities thrown my way.

Brain stack overflow 🤢

In the last few years, the major players in the OS/Platform world (Apple, Google, Microsoft, Amazon) seem to be converging towards a programming language mean. While BASIC, LISP, and C++ were once very popular and are still very relevant, the newest programming languages seem to be very JavaScripty.

JavaScript started this tread by adopting the features of it older brother and sisters (strong types, object-orientation, and functional features) while keeping its boilerplate-free syntax. JavaScript is the BASIC of the 21st century-–Easy to learn and widely available.

In the 20th century JavaScript was a terrible programming language. (One of my favorite books, JavaScript the Good Parts, spends most of its pages on JS's bad parts.) But JavaScript is evolving rapidly towards a paragon of power and grace with the ECMAScript 2016 standard, dialects like TypeScript, and platforms like Node.js.

Apple and Google have noticed how powerful and yet accessible JavaScript has become. Instead of adopting JavaScript for their mobile platforms (that would be too easy) they are doing something almost as good: Creating and supporting JavaScripty languages.

Apple started a few years back with its surprise introduction of Swift. After decades of pushing Objective-C and it’s highly idiosyncratic syntax as the way to build macOS and iOS apps, Apple decided to abandon billions of lines of code for a wholly new language that was pretty, slow, and immature. Swift sprung into existence unasked for and unneeded.

Except something better than Objective-C was needed. The bar for programming Objective-C is very high. And Objective-C is only used in the Apple universe. So it was not only hard to learn how to code iOS apps and it was equally hard to find programmers to code iOS apps.

In the years since its introduction Apple continued to rapidly evolve Swift, much to the horror of many engineering managers. The Swift 3.0 of today is an expressive general purpose programming language and a model for where JavaScript could go.

Google too is jumping on the JavaScripty bandwagon. At Google IO, perhaps out of Apple-envy, Google surprised its programmer community by announcing “first-class support of Kotlin." Until that announcement the Android world revolved around Java and C++. While the two venerable programming languages are more mainstream than Objective-C they still represent a cognitive hurtle for mobile programmers and facilitated a critical shortage of Android developers.

Kotlin is one of the many interesting JVM languages. It compiles to byte code and feels much like JavaScript in its expression. Many Android programmers were already using Kotlin but with Google’s official blessing and support, Kotlin will become the default for beginners and experts Android programmers alike. C++ and Java will be reserved for high performance or simply fade away. (Nobody is pining away for Objective-C on the Apple side of the world.)

Javascripty to the rescue 😎

So the web, Apple, and Google are converging on programming languages that are almost, if not exactly, the same. Why is that? Why are JavaScript (and it's dialect TypeScript), Swift, and Kotlin beginning to feel like kissing cousins where a programer proficient in one could easily master the others? Because programming as a human activity has matured over the last 50 years. We programmers now know what we want!

  • Brevity: Don’t make me type!
  • No boilerplate: Don’t make me repeat myself!
  • Immutability by default and static typing: Help me not make stupid mistakes!
  • Declarative syntax: Let me make objects and data structures in a single line of code!
  • Multiple programming styles including object-oriented and functional: One paradigm doesn’t fit all programming problems.
  • Fast compile and execution: Time is the one resource we can’t renew so let’s not waste it!
  • The ability share code betwixt and between the frontend and the backend: Because we live in a semi-connected world!
  • Really smart IDE integration: The editor and the compiler should point me to the correct syntax and help me navigate the documentation interactively.

There you have it. Accidentally, in a random and evolutionary way, the world of programming languages and tools is getting better and more interoperable, without anyone in charge. I love when that happens.

John Pavley

Read more posts by this author.