September 7th, 2017
Introduction to Kotlin
- Statically Typed Language
- Inspired by Java, Scala, C# and Groovy
- Under progress (Native)
- Industrial purpose language
- Any type of application like
- Web, Desktop, Server-side
- Deep Android adoption
- Gradle has adopted it for its scripting and plugins
- Similarity to other language allows quick ramp-up time
- Interoperability allows gradual adoption:
- The advantage of this is that it can allow developers to mix and match the java code with Kotlin.
- Kotlin 1.0 was released in Feb 2016
- Many companies including Amex(American Express), Netflix, and NBC News Digital use Kotlin.
Introduction to the JAVA VIRTUAL MACHINE A.K.A JVM
In simple words, JVM is an abstract machine that helps in executing Java applications.
JVM is composed by
- Single specification, multiple implementations (OpenJDK most common).
- An instance is what runs a Java application
- Applications compiled to Bytecode
- In terms of running applications, we have two facilities JRE and JDK.
Languages on the JVM
- Truly polyglot ecosystem
- All languages are either compiled to Bytecode (or Transpile to Java first)
- Kotlin, Scala, Ceylon, Clojure, Frege
KOTLIN and JAVA
- Kotlin and Java are 100% interoperable
- You can call java from Kotlin and vice versa
- You can use Java library
Installing the Tools
To get up and running you need the following tools:
- JDK 6/7/8 and if you are targeting Android, try JDK 6
- Kotlin compiler
- IDE intelliJ IDEA ultimate edition or Community edition
Kotlin official download Link
The KOTLIN REPL
REPL stands for READ, EVALUATE, PRINT, LOOP, Interactive way in which we can work with Kotlin programs.
If you have Kotlin compiler installed in command line type kotlinc for REPL to start working for you. You can start interactive REPL and start coding as you wish right away.
You have two ways to use the REPL you can use your terminal and intelliJ IDE for starting to the REPL.
Kotlin with IntelliJ IDEA
Download community edition IntelliJ IDEA. It is free and it lets you get started on building awesome Kotlin projects immediately.
Conventions used with Kotlin and Summary
Most of the programming syntax follows the Java convention if you are not familiar with the conventions lets go over them again.
- Follows the Java coding conventions
- Lower camelCase for names
- Types in Uppercase
- Methods and Properties Lower camelCase
- Packages following reverse notation
- Multiple classes per file allowed
- Package does not have to match the folder names
- It was released on Feb 2016
- On the JVM it generates Bytecode
- Fully interoperable with Java
To find out more about Kotlin, and for constant updates, keep watching this space – http://bit.ly/DunstTech-Kotlin