Any software engineer will tell you that there’s a library of options, pun intended, when it comes to choosing a programming language to specialize in. The answer to this question depends a lot on the functionality you want your code to possess, how optimized you want your code to be and the time constraints of your project.
Today, we’re going to add another tool to your arsenal, and highlight 9 key insights about the Kotlin programming language that’ll make you seriously consider it the next time you work on a new project.
IT’S RELATIVELY NEW
When you think of programming languages, you most likely think of classics that date back to the 90s like Java or Python, which is why it may surprise you that Kotlin is a language that appeared only 10 years ago in 2011. As a result, you may notice that the syntax is modern, building off the syntaxes of older languages like Java, but minimizing the frustrations that go along with languages like that.
IT’S A RELAXED VERSION OF JAVA
One of the first things you’ll notice about Kotlin is that it takes influence from Python in that it doesn’t require a semicolon at the end of each line, rather replacing the semicolon with a newline character to signify the end of a line of code. Aside from that, however, it retains a lot of the syntax of Java; you’ll have a remarkably quick transition if you decide to switch over, and will notice a lot of features that’ll reduce the infamous headaches associated with programming in Java.
IT FEATURES TYPE INFERENCE
While Kotlin is technically a strongly typed language, it boasts the ‘val’ and ‘var’ keywords which allow the language to infer what datatype you wish to use for your variables without requiring you to explicitly define them – saving you quite the headache. But for all of you that like to make sure that your strings stay as strings, don’t worry – type declaration works just fine too.
IT FULLY SUPPORTS FUNCTIONAL PROGRAMMING
Kotlin makes it clear that it is completely on-board with you using it as a functional programming language – boasting support of higher-order functions, anonymous functions, lambdas, inline functions, and all of the other features that you would expect in a language designed purely for functional programming.
In other words, Kotlin may be the one-stop shop for whatever project you’re wanting to take on – able to support many different paradigms at once. Compare this to Java, which can technically support functional programming through lambda functions, but doesn’t even compare to the suite of options that Kotlin offers to both new and experienced programmers.
IT HAS A VARIETY OF SAFETY OPTIONS
We’ve all been there – maybe a null pointer exception is just not making sense to you at all, or maybe you’ve accidentally assigned a null value to a variable and haven’t noticed it until your code makes it all the way through production and onto QA. Kotlin, fortunately, is there for you.
It has the handy feature of making ‘null’ illegal for standard data types, but gives you the option of allowing it by putting a question mark after you declare the datatype. This question mark will be your new best friend in Kotlin, allowing you to run tests on your variables that simply return ‘null’ if the variable is null, letting you know right away the state of your variables without throwing annoying runtime errors.
IT’S THE RECOMMENDED LANGUAGE FOR ANDROID DEVELOPMENT
“Android development will become increasingly Kotlin-first,” Google writes in an announcement on May 8, 2019. “Many new Jetpack APIs and features will be offered first in Kotlin. If you’re starting a new project, you should write it in Kotlin; code written in Kotlin often means much less code for you–less code to type, test, and maintain.”
You should take these words seriously – I mean, Google is one of the main developers of Android itself, so they clearly know what they’re talking about. This came as a shock to some developers – Google had been a huge supporter of Java for the longest time when it came to development for Android, so their switch to Kotlin seemingly out of nowhere definitely made the language a popular choice for many app developers.
IT COMPILES WITH EXISTING JAVA CODE SEAMLESSLY
One of the main selling points of Kotlin is that it is a 100% Java-interoperable programming language, which means that it is consistent with Java and all of its related tools and frameworks. This means that, if you want to make the switch, you can do it step-by-step, incrementally changing aspects of your code until it is fully in Kotlin. Fortunately, if you can’t write your code completely in Kotlin, you can use it alongside Java without running into any annoying problems in your builds.
While, so far, we’ve listed many pros of Kotlin and why you should consider using it, it would be unfair if we didn’t highlight some of the potential drawbacks that come with this hot new language.
IT’S NOWHERE NEAR AS POPULAR AS A LOT OF OTHER LANGUAGES
Even with the help of Google, Kotlin falls behind in terms of popularity. This has a few drawbacks to it that may turn you off learning Kotlin altogether. For one, the job market for Kotlin is significantly smaller than that of other, bigger programming languages. It’s more attractive to recruiters if you have Java on your resume instead of Kotlin, even though we’ve highlighted how the languages share a lot in common.
COMPILATION ISN’T AS CLEAN AS JAVA
This may seem a bit nit-picky, but nitpicking tiny features is what software engineers do best. In some cases, Kotlin actually compiles faster than Java, especially when performing any kind of incremental builds. However, it’s clear that if you want stability and efficiency in your builds, Java trumps Kotlin by quite a significant margin.
KOTLIN ENGINEER SALARIES
We’ve crunched the numbers on average Kotlin engineer salaries, only taking the cash compensation into consideration.
Silicon Valley tops the average salaries with Kotlin coders commanding base salaries of around $125,000 per year.
Not far behind, New York City-based Kotlin developers are earning $120,000 per year for comparable roles.
And while it has improved over the year, Kotlin engineers in Austin, Texas can expect to earn just into the 6 figures at $105,000 per year.
YOUR NEXT STEPS
The Kotlin language is still fairly young – which means it has many areas in which it can grow and become more widely used. Even if you’re not convinced to look into it now, you should keep an eye on it as it develops and becomes more mainstream so that you make sure you can jump on this opportunity as soon as it looks worthwhile. It may seem that Kotlin is simply a wannabe Java, but overtime, it may take over Java’s long held position and become the new industry standard.
If you enjoyed this blog you may also enjoy our other blogs like, Rust Programming Language: 5 Things You Need to Know or 7 Things You Need to Know About Typescript.
Kofi Group is proud to be a source of knowledge and insight into the startup software engineering world and offers a multitude of resources to help you learn more, improve your career, and help startups hire the best talent. If you are interested in learning more about what we do and how we can help you then get in touch or watch our Youtube videos for additional information.