A New Movement in Android Programming

For most Android developers, they may be used to write their application using the most popular programming language — namely, Java. It is not true that Java is the only available language that supports Android development. In fact, there are several other programming languages that are capable of doing so; to name a few, there are React Native, Python and also JavaScript.
The main reason Java is the most preferable programming language for this purpose is probably not from its ease of use. Instead, it is because Java has been popular to begin with. Many of the world’s biggest companies use Java to build desktop apps and back-end systems, hence lots of programmers learn Java and are used to it. There is even a saying that if you know Java, chances are you won’t be desperate for work. Although, to be fair, Java requires too much work to get so little done; for example, you need about 10 lines of code to open a file in Java while Ruby can do that in one line.
The fact that Java requires a lot of pointless ceremonial code is unavoidable. Although some may not consider it as a problem and it may be one reason for new programmers to understand the detail in every code they write, it can not be denied that it reduces the productivity. It is essential to have a high productivity in work environments, and having a good programming language to do the job that is efficient in terms of writing code lines is one way to improve it; of course, without setting aside the performance.
In this field, Kotlin comes as a solution to the problem. Developed by a team of JetBrains — A company which created one of the best IDE for Android development, Android Studio — it can be a programming language to replace Java, with less ceremonial code and compiles as fast or slightly faster than Java.
Learning Something New
When talking about a change to a standard, people may become hesitant as they are used to the old standard. To be precise, we are talking about Java, a programming language that has been here since about 22 years ago and is used in a wide range of uses. Transitioning from Java to other programming language can be harder than we may think. However, it should not be worried because Kotlin is easy to learn.
The main reason people avoid change is that they have to do or learn something new; in this case, to learn a new programming language. It is good to know that Kotlin has an incredibly low learning curve for people who are used to Java already. They have a method that converts Java classes to Kotlin classes in IntelliJ (and Android Studio). Converting your codebase to Kotlin is actually very easy. In fact, it’s so easy that there is a keyboard shortcut to do it automatically.
Kotlin also requires fewer lines of code to do the same thing as other programming languages. It is an inherently concise language, so it can solve many common development problems with just a few lines of code.
For example, you can create a data class just like this:
data class Note (
var id: Int = -1,
var text: String? = null,
var isPinned: Boolean = false,
var createdAt: Date = Date(),
var updatedAt: Date? = null
)That simple code will take care of data-related things like identity, hashing, and copying for you. The compiler will take all of the variables from your classes constructor and use them to generate your classes identity. Compared to Java, the lines of code needed to create a functionally equal data class will take a about 50 lines or even more.
The most important thing is that Kotlin is 100% interoperable with Java, so apps you’ve already built can be migrated to Kotlin incrementally. You don’t need to stop using Java — you can use both! Extension functions give you a way to add functionality to existing classes (even Java classes) without a full rewrite to Kotlin. This means you can take advantage of Kotlin’s powerful features without having to abandon all the skills you’ve gained while building existing apps.
With this being an advantage, the productivity of the programmers can be higher than those who use Java.
The Future of Kotlin
Google announced support for Kotlin in Android at Google I/O 2017, but many of us were not sure what is going on or why we should care. As mentioned before, Kotlin is developed by JetBrains whom created Android Studio. JetBrains implemented Kotlin on Android Studio in October 2017 and is supported by Google for use with their Android operating system.
JetBrains’ thoughtful work on Kotlin’s design is one of the reasons we should embrace the language. Google is partnering with JetBrains to ensure a wonderful overall developer story — from language, to framework, to tools. With two big companies involved in its development, Kotlin’s future in android development is ensured to be very bright.
However, it is not all sugar and spice. For the near future, you may consider not to look for employees or team members with decent Kotlin knowledge as the requirement because the language is fairly new to this field and people are still learning it. If you really want to, your trade-off will be fancy code vs. have your new employees learn a new language to understand your app, considering there are already a lot of people who are experienced in Java.
Kotlin is a good programming language, but it needs more time to grow. We need to wait until the community who uses it is big enough and there are quite a lot of people to teach and learn it. For now, we can only expect people to acknowledge Kotlin’s quality and have them learn by themselves.
