Android engineers, still wondering whether to switch to Kotlin?

overview

Kotlin is an emerging language that runs on the JVM. It is only a dozen years old. In 2017, Google officially recommended Kotlin as the preferred language for Android development. It has been more than 5 years since then. In the past 5 years, Kotlin has developed rapidly with the help of Android. , It can be described as a rapid development. At present, Kotlin is the main language for android development in foreign countries, while Java is still the main language in China. Many engineers are also struggling with whether to switch to Kotlin.

Advantages of Kotlin

  • Less Code, More Readability
    Spend less time writing code and understanding other people's code.
  • Mature language and environment
    Since its creation in 2011, Kotlin has grown throughout the ecosystem not only through the language but also through powerful tools. It is now seamlessly integrated into Android Studio and is actively used by many companies to develop Android applications.
  • Kotlin support in Android Jetpack and other libraries
    The KTX extension adds Kotlin language features such as coroutines, extension functions, lambdas, and named parameters to existing Android libraries.
  • Interoperability with Java
    You can use Kotlin with the Java programming language in your applications without migrating all your code to Kotlin.
  • Support multi-platform development
    Not only can use Kotlin to develop Android, but also can develop iOS backend and web applications. Enjoy the benefits of sharing common code between platforms.
  • Code Safety
    Less code and better readability lead to fewer bugs. The Kotlin compiler detects these remaining errors, making the code safe.
  • Easy to learn and use
    Kotlin is very easy to learn, especially for Java developers.
  • Big community
    Kotlin has great support and many contributions from a community that is growing all over the world. According to Google, more than 60% of the top 1000 apps in the Play Store use Kotlin.

Problems and suggestions that may be encountered when switching to kotlin

  • The old project is 100% java project, it is difficult to transfer to kotlin, and even androidx is not adapted.
    It is not recommended to transfer to kotlin. If refactoring is required, it is recommended to transfer to kotlin
  • Team projects have different levels of staffing.
    Java and Kotlin can be used together. It is not necessary for every member of the team to be familiar with Kotlin.
  • I am used to java, but I still need to learn another language. I don’t think it is necessary to
    jump out of my comfort zone. Kotlin is the future, and the cost of learning is not high. Moreover, the new libraries officially launched by Google are all written in Kotlin. Kotlin accounts for the proportion of Android development languages. It will get higher and higher, java has been declining in android development
  • First in the Java universe, kotlin? It's still far behind.
    Java is a very good high-level programming language. Every version of it is getting better. These are all facts, and the Java language has dominated the list for a long time. Many engineers think that Kotlin is not a The programming language is more like the syntactic sugar of java, but what I want to say is that when you try it, you will feel that the sugar is really sweet! The Undoubted Law of True Fragrance

Summarize

For android development, there is no doubt that kotlin is the future. With the official recommendation of Google, the learning cost is not high, and you can transfer as soon as possible! This is my suggestion, go around! What are you waiting for

Guess you like

Origin blog.csdn.net/quanzhan_King/article/details/130961061