KOTLIN: Architecture

From OnnoWiki
Jump to navigation Jump to search

Sumber: https://www.tutorialspoint.com/kotlin/kotlin_architecture.htm


Kotlin is a programming language and has its own architecture to allocate memory and produce a quality output to the end user.

Following are the different scenarios where Kotlin compiler will work differently.

Compile Kotlin into bytecode which can run on JVM. This bytecode is exactly equal to the byte code generated by the Java .class file.

Whenever Kotlin targets JavaScript, the Kotlin compiler converts the .kt file into ES5.1 and generates a compatible code for JavaScript.

Kotlin compiler is capable of creating platform basis compatible codes via LLVM.

Kotlin Multiplatform Mobile (KMM) is used to create multiplatform mobile applications with code shared between Android and iOS.


Kotlin adalah bahasa pemrograman dan memiliki arsitektur sendiri untuk mengalokasikan memori dan menghasilkan output yang berkualitas kepada pengguna akhir.

Berikut adalah skenario yang berbeda di mana compiler Kotlin akan bekerja secara berbeda.

  • Kompilasi Kotlin menjadi bytecode yang dapat berjalan di JVM. Bytecode ini sama persis dengan kode byte yang dihasilkan oleh file Java .class.
  • Setiap kali Kotlin menargetkan JavaScript, kompiler Kotlin mengonversi file .kt menjadi ES5.1 dan menghasilkan kode yang kompatibel untuk JavaScript.
  • Kompiler Kotlin mampu membuat kode yang kompatibel dengan basis platform melalui LLVM.
  • Kotlin Multiplatform Mobile (KMM) digunakan untuk membuat aplikasi seluler multiplatform dengan kode yang dibagikan antara Android dan iOS.


kotlin Architecture

Whenever two byte coded files ( Two different programs from Kotlin and Java) runs on the JVM, they can communicate with each other and this is how an interoperable feature is established in Kotlin for Java.

Kotlin Native

Kotlin/Native is a technology for compiling Kotlin code to native binaries, which can run without a virtual machine. Kotlin/Native supports the following platforms:

  • macOS
  • iOS, tvOS, watchOS
  • Linux
  • Windows (MinGW)
  • Android NDK
  • Many more...

Kotlin/Native is primarily designed to allow compilation for platforms where virtual machines are not desirable or possible, for example, embedded devices or iOS.

It is easy to include a compiled Kotlin code into existing projects written in C, C++, Swift, Objective-C, and other languages.


Kotlin/Native adalah teknologi untuk mengkompilasi kode Kotlin ke biner asli, yang dapat berjalan tanpa mesin virtual. Kotlin/Native mendukung platform berikut:

  • macOS
  • iOS, tvOS, watchOS
  • Linux
  • Jendela (MinGW)
  • Android NDK
  • Masih banyak lagi...

Kotlin/Native terutama dirancang untuk memungkinkan kompilasi untuk platform di mana mesin virtual tidak diinginkan atau tidak memungkinkan, misalnya, perangkat yang disematkan atau iOS.

Sangat mudah untuk memasukkan kode Kotlin yang dikompilasi ke dalam proyek yang ada yang ditulis dalam C, C++, Swift, Objective-C, dan bahasa lainnya.

Quiz Time (Interview & Exams Preparation)

Q 1 - Kotlin code can be compiled into Javascript code?

A - True

B - False

Q 2 - Compiled Kotlin code can be included in which of the following language code?

A - Objective-C

B - C/C++

C - Swift

D - All th


Referensi