Saltar al contenido ForoHackers

Kotlin: start here

Kotlin
#3065 · · Citar · Denunciar

Kotlin is a modern, statically typed language that is concise and safe, and runs on the JVM, in JavaScript and as native code. It interoperates fully with Java, so it can be adopted one file at a time. It is the main language of Android development and is widely used for back-end services and shared code across platforms.

Key concepts

  • Null safety: the type system separates values that may be null from those that cannot, and forces you to handle the first.
  • Concise classes: data classes, properties and default arguments remove boilerplate.
  • Immutability by default: read-only values and collections are the encouraged style.
  • Functions as values: lambdas, extension functions and higher-order functions give a light functional style.
  • Coroutines: structured concurrency written like sequential code.
  • Java interoperability: call Java libraries directly and be called from Java.

Vocabulary

  • Extension function: adds a function to an existing type without changing it.
  • Sealed class: a closed set of subtypes, ideal with exhaustive when expressions.
  • Smart cast: the compiler narrows a type after you check it.
  • Multiplatform: sharing Kotlin code between several targets.

What to study, in order

  1. Basic syntax, val and var, functions and control flow, with a small program.
  2. Null safety, data classes and collections; convert a Java class to Kotlin.
  3. Lambdas, extension functions and sealed classes with when.
  4. Coroutines: launching, suspending, cancelling and handling errors.
  5. A project in your target, such as an Android app or a server, with tests.

Related tags

#java #android #functional-programming #cross-platform

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder