Now I am using Kotlin to develop Android for 12 reasons (KAD 30) and kotlinandroid
By Antonio Leiva
Time: Jul, 11,201 7
Link: https://antonioleiva.com/reasons-kotlin-android/
This group of articles has reached the end, and they are very practical. Today I want to talk about why I think it is very interesting to learn Kotlin.
Although Kotlin is now an officially supported programming language for developing Android apps, you may still feel that there is not enough reason to make changes. Java has proved its capabilities over the years. Why should it be changed?
I think switching to Kotlin is not an adventure bet, but one of the best things you can do.
Related Articles on Tweet:
Here are my reasons why I think that moving to # Kotlin is one of the best things you can do.
1. Mature languages and development environments
Different from other development languages (such as Swift ),KotlinThe release has gone through many stages before the final 1.0 ReleaseVersion.
This means that there is almost no problem when using Kotlin, And everything meets your expectations.
IDEKotlinSmooth agent runningAnd allow you to use Java and many of your favorite Java features. Therefore, it is great to use Kotlin at this level.
It is interesting to know the history of the final version. It takes several years for Alpha and Beta versions. Even before the Beta version is released, it has been used by developers in actual projects.
Related Articles on Tweet:
# Kotlin is a mature language, been through several years of alphas and betas until its final release.
2. It makes Android development easier
If you have been reading this series of articles about Kotlin, you are very clear about this.
KotlinIntegrates many simple capabilitiesIf you switch from Java, there will be a new world. In Java, you cannot imagine this.
HonestlyYesJavaDevelop AndroidThe only feasible solution for excellent applications. Other alternative products (such as Scala) are very heavy and cannot match with each other in terms of Compilation Time and tools.
Today, Kotlin Compilation Time is similar to Java (in some tests it may be faster). It requires a very small library to write applications using Kotlin, so it does not increase the number of methods.
Related Articles on Tweet:
# Kotlin is simplicity mixed with power. You have a new world of possibilities if you're coming from Java
3. seamless integration with Android Studio
This may sound silly, but from the first minute, everything has worked well, which is a great advantage.
You have read it. If you try to create a Kotlin project, it will take 10 minutes to complete, even if you do not know Kotlin.
Related Articles on Tweet:
You can have a project set up and ready to work in less than 10 minutes in your first use of # Kotlin
To use Android 2.3, you only need to install a plug-in. In Android 3.0, the entire process is seamless integration.
(Note: Android 2.3 and 3.0 should refer to Android Studio .)
From then on, all the work is like using Java: You can run the IDE, check whether there is a problem with debugging, perform refactoring, and use real-time running... Everything you can think of can be used.
4. Its evolution is well covered
Behind Kotlin is Jetbrains, which they use in their own projects, so they will develop it more actively.
In addition, for Android, it is supported by Google and has two major companies working together to provide us with the best development languages and tools.
From features (such as Kotlin Android Extensions) to libraries (such as Anko), continuous optimization of library size and build time indicates that Jetbrains is investing a lot of energy into Android.
5. If you are an Android developer, you need to keep learning
Let's face it:Continue to useJava 6Make us an outdated programmer.
It wasn't until I started learning Kotlin. Once you use modern development languages, you will begin to think differently.
Even if you do not change the development language, you should apply the new knowledge to your code. In Java, I solve the problem in different ways, just because I have learned a lot of concepts that I didn't know before.
In addition,You will become more versatile. Later, I saw (or even used) some languages, such as Swift, Groovy, and Ruby. Since they all use very similar concepts, it is easier to understand them.
Concepts such as lambdas, extended functions, set function operations, sealed classes, and data classes may have different names, but you can find them in most modern languages. In this way, you only need to map the conversion of one language to another, and you can easily switch the development language.
Although we like Android, if we want to switch to another language or platform, it will bring great value to our developers.
Related Articles on Tweet:
If you are an # AndroidDev, you need to recycle: Java 6 makes us obsolete programmers
6. It is safer than Java
You cannot imagineNullPointerExceptionHow tired I am. In fact, whenever I see a person, I feel really frustrated, because this is a major problem in language design.
I do not deny that we now have some tools, such as annotations or design patterns, that can help us avoid part of the work. However, as in the past, additional work is a matter of time and money.
However, we cannot just talk about null. We need all the Kotlin code:
- Fewer errors: If there are few codes, the chance of code travel is small, so it is more stable.
- During compilation,The compiler helps you detect errors, They will not occur during running (this is truly obvious)
- The code is more readable, easier to understand, and more difficult to get new errors.
- This is because we have avoided any templates that can only overcome language limitations, and the code functions are clearer (rather than what ).
In addition, it can do more work in less time, more stable, and less time to fix bugs.
Related Articles on Tweet:
# Kotlin features translate into more work done in less time, and less time spent in fixing bugs.
7. Existing well-known companies use it to develop their products
For example, Pinterest has been used in the new features of the Android app. You can hear Christina Lee talk about her experience using it on Pinterest.
The other is Basecamp, which has been written by Kotlin 100% of Android applications. Dan Kim wrote:
Kotlin is the official development language of ANDROID 100%. -Dan Kim (@ dankim) May 17,201 7
You can also read their experiences in these articles: Articles 1 and 2.
Trello Code also includes some Kotlin code:
Data points (Android Developers curious about Kotlin): @ trello is now happy to use @ kotlin in development. -Dan Lew (@ danlew42) December 14,201 6
On the Kotlin website, you can see that more and more companies are using Kotlin for development in their products without any trouble.
8. Companies are requesting to use Kotlin in their job opportunities
Not only do companies already use Kotlin, but developers are beginning to be interested in Kotlin. I have trained some large companies in Spain, with increasing interest.
Enterprise in employee KotlinIncreased training fundsThis is a good sign.
9. Kotlin is multi-platform
You learn Kotlin not just to write Android applications. Kotlin is first created in JVM, soIt can run on anyJVMUsed on devices.
But in Kotlin 1.1, Kotlin JS (which was just experimental at that time) was finally released, soYou can also useKotlinFrontend Development.
However, it does not end with this. Thanks to Gradle's support, you will be ableInKotlinCompile your GradleFileAndThanksKotlin NativeIn the future, it will be an open platform.
Writing Android applications is just the tip of the iceberg.
Related Articles on Tweet:
With # Kotlin, you can write # AndroidDev, server, frontend, Gradle scripts and even native Apps.
10. "Micro-niches" is very profitable.
Although Kotlin is not adopted in most companies, some people are using it.If these companies want to grow, they will needKotlinExperts.
Some people have mastered almost never used super strange languages, but since they are one of the few language experts in the world, they have made a lot of money.
After the announcement of Google, Kotlin will soon become a niche, but you have to stand out for a while.
11. It is easy to learn
Kotlin has the following advantages,JavaDevelopers even if they haven't written a line of KotlinCode, but also can understand most of the Code.
This is because Jetbrains are very concerned about the simplicity of transition from Java, and their language is very similar to what you know.
Thanks to the simplicity of the language and the help of IDE and compiler, you can quickly process the basic knowledge of the language.
The only complicated part is to understand the concepts that Java lacks, rather than the Kotlin syntax itself.
I don't think it takes more than two weeks for anyone to feel the comfort of coding with Kotlin.
Related Articles on Tweet:
An # AndroiDev can understand most of the code without ever having written a line of # Kotlin
12. Interesting to use
In short (although subjective), I found Kotlin really interesting.
For me, it is becoming more and more troublesome because of Java's feature limitations, its samples, and design problems.
However,KotlinOpening up a new possible world for your creativityTo solve the same problem in a very different way.
I spent a few hours in front of the computer, searching for ways to simplify the daily tasks in Android development, and enjoying a lot in the process.
Related Articles on Tweet:
# Kotlin opens up a new world of possibilities for you to be creative in # AndroidDev
Conclusion
In my opinion,KotlinIs very friendly.It is really interesting. It will expand your thinking and let you think differently. The most important thing is that it is ready for product development.
It is now the official language for Android development!
This is the last article in 30 articles. I have published Kotlin for the last seven months.
Since then, many things have happened (Kotlin 1.1 and Google announced), hoping that they will become a good tool for people to learn Kotlin and improve their learning.
However, if you want to learn more quickly, use examples. I suggest you get a book: Kotlin for Android Developers, through this book, you can learn how to use Kotlin to create a complete application process from scratch.
Of course, I will continue to write more articles about Kotlin and Android. Please keep in touch!