Google announced today that the Kotlin programming language is now the language of choice for Android application developers.
“Android development will increasingly be Kotlin first,” Google wrote in a statement today. Many of the new Jetpack apis and features will be available first in Kotlin. If you’re starting a new project, you should write in Kotlin; Writing in Kotlin usually means less code — less code for typing, testing, and maintenance.”
Just two years ago at I/O 2017, Google announced support for Kotlin in its Android Studio IDE. This is somewhat surprising, given that Java has long been the language of choice for Android application development. Over the past two years, Kotlin’s popularity has only grown. Google says more than 50% of professional Android developers now use the language to develop their apps, and it was ranked as the fourth most popular programming language in the latest Stack Overflow Developer survey.
“We’re announcing that the next big step we’re taking is that we’re going to put Kotlin first,” said Chet Haase, chief advocate for Android.
“We know that not everyone is using Kotlin right now, but we believe you’re going to need it,” Haas said. “You may have good reasons to continue using C++ and the Java programming language, and that’s perfectly fine. These languages are not going away.”
Back in 2015, Kotlin was dubbed the “Swift of the Android world.”
Kotlin is a statically typed JVM language similar to Swift, designed and developed by JetBrains and open source. Kotlin’s syntax is more concise and expressive than Java’s, and offers more features, such as higher-order functions, operator overloading, and string templates. It is highly interoperable with Java and can be used simultaneously in one project.
According to JetBrains, based on their years of experience developing the Java platform, they believe that the Java programming language has certain limitations and problems that are impossible or difficult to solve due to the need for backward compatibility. So they created project Kotlin, with the main goals:
-
Create a Java-compliant language
-
Compile at least as fast as Java
-
More secure than Java
-
More concise than Java
-
It’s simpler than Scala, its most mature competitor
At the time, the Swift title of the Android world seemed more like a good wish than a good one. So after Google I/O 2017 and 2019, it’s a valid argument.
Many new languages seem to arise out of boredom with another language, and Kotlin seems to do the same. But for JetBrains, the original motivation behind the Kotlin project is productivity. Speaking to InfoQ, Hadi Hariri, Head of developer Support group at JetBrains, said:
“Although we had already developed support for several JVM-based programming languages, we were basically writing IntelliJ-based apis in a Java environment. The IntelliJ development system is based on Groovy and Gant, Groovy is also used for testing, and there is some JRuby code in RubyMine, so that’s the case. We want to move to a more expressive language to increase productivity. At the same time, we cannot accept compromises on Java interoperability or compilation speed. “
Statements such as “Kotlin is better than Java”, “Kotlin is more readable than Java”, and “Kotlin is faster to develop than Java” are not supported by accurate data, so they are considered subjective.
Subjective opinions are formed when individual developers make one or more subjective judgments about topics related to Kotlin or Java.
The developer’s subjective judgment has the following problems:
-
There are no quantitative indicators associated with subjective judgment.
-
Subjective judgment is highly biased.
-
Judgment bias varies widely among developers.
Since there are no quantitative indicators associated with subjective judgments, opinions based on those judgments simply reflect pre-existing biases on the part of developers. Different developers can have very different biases, so just because one developer thinks Kotlin is a good (or bad) alternative to Java doesn’t mean other developers do.
Moreover, since there are no objective indicators, subjective differences cannot be objectively resolved, which often leads to a war of words.
Kotlin does have some big advantages over Java: it’s efficient, easy to maintain, reliable, and easy to learn. In some cases, many Java developers switch to Kotlin for some reason: people who are fed up with Java NullPointerExceptions like Kotlin’s Null security feature; Extension functions are heavily used; In addition to extending Java classes, people often migrate Java code to Kotlin.
More than 87 percent of the 2,744 people surveyed have completed the migration, according to data from U.K. software company Pusher. Some of them used the migration wizard or manually modified the code. More than a quarter of the participants who migrated to Kotlin returned to Java. There are technical reasons as well as organizational reasons. Tools that use reflection or code generation are the most cited factors.
-
“Kotlin’s enumerations cannot contain constants. In custom annotations (such as @intDef), the values need to be stored in an enumeration to keep the interface clean.”
-
“We’re using Realm, but it can’t be used with data classes.”
-
“We used Retrolambda in our Java code because it was hard to switch to Kotlin because the type was missing.”
-
“The other team didn’t like Kotlin, and we didn’t expect that.”
-
“We didn’t decide that. We followed the rules of the company.”
Java is still the no. 1 programming language. But is Java the best language? No, because there are more appropriate programming languages for each domain.
So what is it about the Java language that makes it to the top of the charts?
-
First, the grammar is relatively simple, learning computer programming developers can quickly start.
-
Second, it has strong competitiveness in several fields, such as server-side programming, high-performance network programs, enterprise software transaction processing, distributed computing, Android mobile terminal application development and so on.
-
The most important point is to meet the requirements of engineering, to be the first choice for enterprise software companies, and also to be favored by Internet companies.
Overall, the Java language is the best in terms of versatility. But you can also see that the Android community is embracing Kotlin faster and faster, and maybe one day, in the Android world, we’ll see Kotlin surpass Java.
Disclaimer: The following content is purely based on the existing facts and reasonable speculation, without any solid.
Remember the long-running Java infringement case between Google and Oracle? In the latest case of a dispute that has lasted for eight or nine years, Google has lost a lawsuit to pay $8.8 billion to Oracle. (Editor’s note: Over the years, several rulings have ruled in favor of and against the two companies. In January, Google appealed to the U.S. Supreme Court for a final ruling.)
In 2010, Oracle, the owner of Java, claimed that Google had infringed on its patents by using 37 Java APIs for free on Android, and that nine lines of code in Android had copied Java. It’s a violation of their copyright.
The nine lines were allegedly copied because a Google engineer working on the Android project at the same time as Sun’s OpenJDK later copied nine lines directly from the OpenJDK into Android. Since Google was not authorized by Sun, Java changed owners after Oracle bought Sun, which was equivalent to violating Oracle’s copyright.
Google argues that the APIs are not copyrighted, Oracle argues that Google’s use of them is very commercial, and Android code written in Java doesn’t run on the JVM. This is divisive for the Java language, and Oracle’s claim that Android is crowding out potential markets for Java ME through improper use of Java apis is the basis for its huge claims.
In early 2016, a Google spokesperson said that Android N (7.0) would no longer use the existing Java APIs content, but instead migrate to an OpenJDKk-based approach that creates a common code base for developers. While there is no way to avoid litigation over Java APIs, it can at least reduce the potential for disputes.
At the 2017 Google I/O conference, Google announced Kotlin as the first level language for Android development, so it can be said that Kotlin has high hopes. Kotlin has since been seen by developers as an alternative to Java.
Over the next year, Google treated Kotlin like a son. Why? Let’s take a look at what Google did for Kotlin this year:
-
In November 2017, Android Studio 3.0 was officially available for download. This version of Android Studio integrates Kotlin language support into the IDE. Code completion and syntax highlighting work smoothly on this version. Android Studio 3.1, released in April, provides better Lint support for Kotlin code and speeds up testing by adding Quick Boot to the Android Emulator.
-
In February 2018, Google released a preview version of Android KTX, a set of extensions that provide a nice API layer on top of the Android framework and support library, making Kotlin code cleaner.
-
At Google I/O 2018, Google released Android Jetpack, the next generation of Android components that combine the benefits of backward compatibility and immediate updates from the support library into more components, improving development speed and quality, and more. Android Jetpack will be fully Kotlin compatible, and it will take advantage of Android KTX to make Kotlin code even cleaner.
All of this is evidence that Google is moving closer to Kotlin, and while Kotlin won’t completely replace Java, it’s not hard to see Google’s bias. In fact, Kotlin is very proud of herself: In November 2017, at the first Kotlin conference, KotlinConf, Kotlin lead designer Andrey Breslav announced that Kotlin would support iOS development and Web development, This represents an important step toward full-platform development for Kotlin.
Kotlin is in the early stages of its development and has a lot of room to grow. Google now sees it as a lifeline in the twilight of Android. It’s 100% Java interworking, but it’s not there to replace Java, it’s there to give developers options. Although a programming language is only a tool for software implementation, there is no absolute right or wrong for a developer to choose any language. But in the age of the Internet, developers need to take the time and embrace change to go further.
QCon Guangzhou Station schedule online, part of the highlights of the plot revealed in advance:
Improve the development experience for Java projects with Clojure
The cross-platform development framework of wechat client was built based on C++
Spring Festival Gala red envelope: the solution to the performance limit challenge
Use JS and C++ to achieve high performance, strong dynamic video AR shooting framework
More programming languages, architecture design, big data processing technology, artificial intelligence related field practices are here, any questions, please contact the small assistant Fishball, tel: 13269078023 (wechat with). Scan the qr code below or click to read the original text, get dry goods information in advance!
Click to see less bug 👇