1 / 12

An Overview of Kotlin Programming Language & Its Features

Kotlin is a new Programming Language for Android App Development developed by JetBrains. This presentation gives you an overview of Kotlin Programming Language and the top feature of Kotlin over Java Programming language.

ficode
Download Presentation

An Overview of Kotlin Programming Language & Its Features

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Android Application Development

  2. Kotlin Programming Statically typed programming language for modern multiplatform applications. Developed by JetBrains which has 20% faster compiler & better multi platform projects support. Kotlin is a new programming language that runs on JVM & can be compiled to JavaScript source code. It is fully supported programming language on Android : Android 3.0 Beta version. Google has announced official support for Kotlin Programming language for Android App Development.

  3. Kotlin Programming Features 1. Concise Kotlin is more concise & reduces the amount of boilerplate code.For example we create a POJO with getters, setters, equals(), hashCode(), toString() and copy() in a single line. data class Customer(val name: String, val email: String, val company: String) 2. Interoperable Kotlin is 100% interoperable with Java language. It means you can easily call java code from Kotlin & Kotlin code from Java. valuserClass = userInstance.javaClass // From an instance

  4. Kotlin Programming Features 3. Open Source It is an open source programming language in which source code is available to the general public for use. Kotlin has open access to source code as The Kompiler — Kotlin compiler, Build tools — Ant and Maven integration, and IntelliJ IDEA plugin — Kotlin’s native IDE. 4. Null Safety Avoid null pointer exception or null reference exception also known as The Billion Dollar Mistake. var b: String? = "abc" b = null // ok

  5. Why to Choose Kotlin Over Java 1. Familiar Syntax Kotlin is also designed to have learning curve for Java developers. Java developers should find that most of the Kotlin syntax feels familiar; for example, the code that's used to create a new class in Kotlin is very similar to Java: class MainActivity : AppCompatActivity() { 2. String Interpolation String templates are a simple and effective way of embedding values, variables, or even expressions inside a string without the need for pattern replacement or string concatenation. This is called string interpolation. val x = 4 val y = 7 print("sum of $x and $y is ${x + y}") // sum of 4 and 7 is 11

  6. Why to Choose Kotlin Over Java 3.Type Inference The compiler figure out the type of an expression from the information in the expression. A simple “VAL” is an easy case for the compiler because the type is clear from the right-hand side. This mechanism is called type inference. This reduces boilerplate code keeping the type safety. val a = "abc" // type inferred to String val c: Double = 0.7 // type declared explicitly 4. Smart Cast In Kotlin Programming Language - The Kotlin compiler tracks your logic and auto-casts types if possible, which means no more instance of checks followed by explicit casts. if (obj is String) { print(obj.toUpperCase()) } // obj is now known to be a String

  7. Why to Choose Kotlin Over Java 5. Intuitive Equals You can stop calling equals() explicitly, because the == operator now checks for structural equality. val john1 = Person("John") val john2 = Person("John") john1 == john2 // true (structural equality) john1 === john2 // false (referential equality) 6. Default Arguments No need to define several similar methods with varying arguments. fun build(title: String, width: Int = 800, height: Int = 600) { Frame(title, width, height) }

  8. Why to Choose Kotlin Over Java 7. Named Arguments Combined with default arguments, named arguments eliminates the need for builders. build("PacMan", 400, 300) // equivalent build(title = "PacMan", width = 400, height = 300) // equivalent build(width = 400, height = 300, title = "PacMan") // equivalent 8. Data Classes It’s a POJO complete with toString(), equals(), hashCode(), and copy(), and unlike in Java it won’t take up 100 lines of code. data class Person(val name: String, var email: String, var age: Int) val john = Person("John", "john@gmail.com", 112)

  9. Why to Choose Kotlin Over Java 9. Operating Overloading A predefined set of operators can be overloaded to improve readability. data class Vec(val x: Float, val y: Float) { operator fun plus(v: Vec) = Vec(x + v.x, y + v.y) } val v = Vec(2f, 3f) + Vec(4f, 1f) 10.Extension Functions Kotlin provides the ability to extend a class with new functionality without having to inherit from the class or use any type of design pattern such as Decorator. This is done by special declarations called extensions. Kotlin supports extension functions & properties. fun String.replaceSpaces(): String { return this.replace(' ', '_')} val formatted = str.replaceSpaces()

  10. Learn More About Kotlin Programming https://kotlinlang.org/ https://en.wikipedia.org/wiki/Kotlin_(programming_language) https://github.com/JetBrains/kotlin http://www.ficode.co.uk/blog/kotlin-programming-language-android-app-development/ https://www.kotlinconf.com/

  11. About Ficode Ficode Technologies Limited is a Web, Mobile & Software Development Company in the United Kingdom. We mainly focuses on delivering best solutions for our client as per their requirement. We have an expert team of developers who can make your idea into reality that’s why, Ficode is one of the leading mobile app development company in London. Our team is fully focused on the latest technologies as Kotlin, Java, PHP & JavaScript a lot more.

  12. THANK YOU FOR WATCHING! CONNECT WITH US www.ficode.co.uk

More Related