Tag Archives: Kotlin

A Closer Look: Why You Should Learn Kotlin

This Post was written by Stephen Sprague
Date posted: February 19, 2018

Whether you’re a new software developer or you’re a veteran looking to expand your skill set, it’s always a good idea to research programming languages. While there are plenty of languages available, the most common Android language is Java. However, Kotlin is starting to catch up, and many developers are taking notice. So, which language should you stick with: Java or Kotlin?

Well, both.

First, Kotlin is completely interoperable with Java. Since Google announced Kotlin as an official language for Android development, the open source, statically typed language has gained momentum. It runs on the JVM and you can easily start using Kotlin on an existing Java project. Many convoluted tasks in Java become simplified and shortened in Kotlin. In many instances Kotlin allows you to add just one word or phrase that replaces at least twenty lines of Java code. The Kotlin website does a great job of outlining key differences between the two languages. As a preview:

  • Null references are backed into its type system (no more NPE!)
  • Kotlin arrays are invariant
  • Kotlin has proper function types, compared to Java’s SAM-conversions.

Second, Java is more traditional. As this article from TechBeacon points out, Java doesn’t have support for method references, streams, or lambdas. It’s also less concise, meaning it takes longer to write and more time to read, which in turn makes it more error prone.

For total beginners…
If you’re completely new to programming, it’s a good idea to start with Java. Most Android code is still written in Java and more learning resources exist. However, once you have a basic understanding of Java, start to integrate Kotlin, and other languages, in your practices as well.

So, will you be challenging yourself to learn a new language? Share your thoughts with us on LinkedIn and Twitter!

Related Posts:

Is Kotlin the Future of Android Programming?

This Post was written by Bridge Technical Talent
Date posted: November 29, 2017

Image: https://blog.jetbrains.com/kotlin/2017/11/kotlin-1-2-released/

If you’ve stayed up to date on programming trends, you’ve probably heard of Kotlin, a language taking the coding world by storm. Kotlin is efficient, concise, and interoperable with Java. Furthermore, it’s an open source, statically typed language created by JetBrains. Also known as the makers of IntelliJ. In fact, predictions state that Kotlin will surpass Java as the primary language for Android apps by next December.

Kotlin has been open source since 2012. However, the newly popular language gained traction thanks to Google. At this year’s Google I/O, the tech mogul announced that Kotlin will be a first-class language for writing Android apps. Additionally, this is the first third-party language Google supports.

So, why should you learn Kotlin? First of all, because it’s always a good idea to stay on top of new languages. Trends in technology change quickly, and you shouldn’t be left in its wake. Secondly, Medium details seventeen reasons why you should make the switch from Java to Kotlin. We’ve listed them below:

  1. Familiar Syntax
  2. String Interpolation
  3. Type Inference
  4. Smart Casts
  5. Intuitive Equals
  6. Default Arguments
  7. Named Arguments
  8. The When Expression
  9. Properties
  10. The Data Class
  11. Operator Overloading
  12. Destructuring Declarations
  13. Ranges
  14. Extension Functions
  15. Null Safety
  16. Better Lambdas
  17. IDE Support

So, if even one of those reasons intrigues you, read the full explanations here. Now, when comparing Java and Kotlin, this article from InfoWorld puts it succinctly:

The question of whether to choose Kotlin or Java for new development has been coming up a lot in the Android community since the Google I/O announcement, although people were already asking the question in February 2016 when Kotlin 1.0 shipped. The short answer is that Kotlin code is safer and more concise than Java code, and that Kotlin and Java files can coexist in Android apps, so that Kotlin is not only useful for new apps, but also for expanding existing Java apps…The typical time quoted for a Java developer to learn Kotlin is a few hours—a small price to pay to eliminate null reference errors, enable extension functions, support functional programming, and add coroutines.

JetBrains released Kotlin 1.2 yesterday, with some pretty helpful updates. To start, Kotlin 1.2 compiles 25% faster than Kotlin 1.1. More exciting to developers? It’s now multi platform. Meaning, the same codebase can be used to build the back- and frontend of Android apps.

What do you think of Kotlin? Have you made the switch? Will you try to learn it? Let us know on Twitter. Or, share your process on LinkedIn.

Related Posts: