Preface – Essay

This year is 2021.

Ten years ago, in 2011, Kotlin was designed and successfully launched by Andrey Breslav, the god of JetBrains. (When I saw “And,” I thought it had something to do with Andy E. Rubin. I looked it up, but it didn’t.)

As an aside, the name Andy Rubin always reminds me of Munchy-D-Luffy.

Pull back,

At Google I/O 2017, they announced their support for Kotlin, and from that day on, Kotlin came onto my radar.

At the time, I looked at the official documentation and learned a little basic grammar.

To be honest, official documents are more suitable as dictionaries to use, when you don’t understand the scene to look up or quite appropriate. But trying to learn Kotlin from official documents is frankly unfriendly.

What I learned was also missing the point, and I didn’t feel Kotlin’s silky takeoff.

For the next two years,

From 2018 to 2019,

The actual projects in my work are all Java development projects. Kotlin hasn’t used it for a long time.

In 2019, Google officially introduced “Kotlin-First” to support Kotlin as a first-level language for Android development. JetPack launched, priority Kotlin update. All is well for a moment.

Android must learn Kotlin! There’s no getting out of it.

In 2020, Kotlin became an app development sensation almost immediately. Coroutines in particular.

It’s almost a war zone.

Our company projects in the old projects in the majority, new projects began to use.

I will take this opportunity to write a column about Kotlin carefully – “Learn Kotlin from The Java Boss”.

I hope my Kotlin exploration can help you. My update frequency is not too fast. What I pursue is the quality and the smooth feeling of slowly explaining knowledge.

Come on! Ollie give!

Both are cross-platform. What’s the difference between Kotlin and Java?

Java is the native language of Android programmers, whether it is JNI’s C, C++, Groovy, Kotlin. Is not as important as Java’s impact on Android.

Of course, Kotlin is already stealing Java’s bread on the Android side. But it will take time.

 

The popularity of Java has a lot to do with its cross-platform nature.

Java’s tagline is “Write Once, Run AnyWhere!”

He did it through the JVM.

In simple terms, Java code is compiled into bytecode, which is the same.

But the JVM is different on different operating systems.

The JVM integrates a set of instructions that execute on the target platform. Operating system differences are handled by the JVM.

Bytecode runs on the JVM to make it cross-platform.

 

First, let’s be clear: cross-platform is nothing new.

An interpreted language, such as JavaScript, runs in a browser, so its programs are naturally cross-platform.

But this is different from what Java emphasizes.

JS leverages browsers across platforms but can only do what the browser environment does.

Java takes advantage of the JVM to be cross-platform, and Java can do things that target platforms can do. That’s the purpose.

 

Classification of programming languages

According to the “translation mode”, programming languages are divided into: compiled and interpreted.

The design idea of Java is to combine these two translation methods to create a compile-explain type.

In my opinion, the fundamental difference between compiled and interpreted is whether machine language is generated.

So Java is essentially an interpreted language, because no machine language is generated, it is executed by the virtual machine.

 

This combination of traditional translation methods can be seen in many languages.

The closest thing to Java is C#, but with a completely different fate. I won’t say that here.

 

At this point, you must think, Java is great. Cross platform is stable.

However, Kotlin tells you, I want it all!

First, Kotlin is a JVM language. So, it has Java’s cross-platform capabilities. Also, Kotlin and Java are 100% interoperable.

So, unlike languages like Scala and Groovy, it’s not intended to be better in the context of DSLS.

It’s Java!

Here, I think the litigation with Google and Oracle over Java has a lot to do with it. 8.8 billion!

 

JetBrains, a Czech company, has a rather dubious relationship with Google.

They developed IDEA, which is their most influential work.

This is the primary development tool for Java developers.

Android Studio is an Android development tool based on IDEA, jointly developed by Google and JetBrains.

After Google lost money, it desperately needed a language to replace Java, because if you keep using it, you risk losing money all the time.

So JetBrains developed Kotlin.

Interestingly, the name Java comes from The island of Java and the name Kotlin comes from the island of Kotlin.

Yeah, I guess this wave is a tribute.

 

The Kotlin Foundation, whose members are mostly employees of the two companies, is responsible for designing the language.

 

With JetPack, and kotlin-Frist.

Kotlin has already established himself in the Android app development world.

But Kotlin has even bigger ambitions.

Maybe from the beginning.

Now that it’s cross-platform, it just doesn’t make sense to stick to Java’s legacy.

If you’re gonna cross it, you’re gonna cross it.

 

As a result, Kotlin supports JS interoperability, and Kotlin can compile binary files to run on all platforms.

Review the

What languages can be compiled into binaries?

Compiled languages.

What language is Java?

Compile-interpreted languages. It is essentially interpretive language.

So, what language is Kotlin?

It’s both. It wants them all.

 

On the server side of Java, the Spring family says, I support Kotlin as well.

So you can expect support for Kotlin to grow.

By the way, I’m also learning to write Gradle plugins using Groovy. Kotlin can also write.

Kotlin also came up with KMM, which is a mobile cross-end solution.

You read that right, Kotlin reaches for iOS.

 

JetBrains says to Kotlin: “You get 70% Android today, 50% Java server tomorrow, 30% iOS and JS the day after tomorrow…

Kotlin: I’ll be black and white the day after tomorrow! !

 

Cross-end is the dream of many programming languages, and without exception, they fail. C# provides cross-terminal Android and iOS technical solution Mono, cool enough.

 

The person in charge of Hongmeng also said in a public interview that Hongmeng is not trying to replace Android, it doesn’t make sense. What Hongmeng wants is a terminal unified scheme.

He is not going to cross the end, he and Android go the way is very similar, cross a wool end, each end is hongmeng, naturally do not need to cross the end.

 

Just like the Internet of cars, smart watches, phones, tablets, smart homes, TVS, Internet of things. Android is everywhere.

That’s what Hung Meng is going to do, and of course, it takes a lot of time.

 

Hongmeng I think is an important reserve for the future of China mobile operating system.

Once Google starts asking for money, our country can switch to the Hongmeng system. Our domestic applications are not based on GMS anyway. It’s a change.

 

I’m an Android developer, so switching to a similar operating system doesn’t really matter to me. He can’t do it all in a day. There’s plenty of time to learn.

Afterword.

Because I want to explain the knowledge clearly, so a lot of common sense knowledge, I will be popular with you through this way.

In the next article, I’m going to talk about the technical essentials of the JVM language.

Consolidating technical knowledge is the key to learn Kotlin well.