Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Kotlin - A Programming Language

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Prochain SlideShare
Kotlin
Kotlin
Chargement dans…3
×

Consultez-les par la suite

1 sur 13 Publicité

Kotlin - A Programming Language

Télécharger pour lire hors ligne

Kotlin is a statically-typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure. Kotlin addresses most of the redundancies in Java programming language, and also new features have been added that could make android application development faster and easier and most importantly a lot of fun.

Kotlin is a statically-typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure. Kotlin addresses most of the redundancies in Java programming language, and also new features have been added that could make android application development faster and easier and most importantly a lot of fun.

Publicité
Publicité

Plus De Contenu Connexe

Diaporamas pour vous (20)

Similaire à Kotlin - A Programming Language (20)

Publicité

Plus par Mobio Solutions (20)

Plus récents (20)

Publicité

Kotlin - A Programming Language

  1. 1. Kotlin A Programming Language
  2. 2. What is Kotlin? ▪ Kotlin is a programming language. ▪ Kotlin is a statically-typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure. ▪ While the syntax is not compatible with Java, Kotlin is designed to interoperate with Java code and is reliant on Java code from the existing Java Class Library, such as the collections framework. ▪ Kotlin support the .kt extension.
  3. 3. History of Kotlin ▪ In July 2011 JetBrains unveiled Project Kotlin, a new language for the JVM, which had been under development for a year. ▪ JetBrains lead Dmitry Jemerov said that most languages did not have the features they were looking for, with the exception of Scala. ▪ Kotlin addresses most of the redundancies in Java programming language, and also new features have been added that could make android application development faster and easier and most importantly lot of fun.
  4. 4. Why Kotlin? ▪ Here, explaining important features of Kotlin which makes you easily switch to the Kotlin ▪ Java Interoperability ▪ Kotlin is 100% interoperable with Java. ▪ You can literally continue work on your old Java projects using Kotlin. ▪ All your favorite Java frameworks are still available, and whatever framework you’ll write in Kotlin is easily adopted by your stubborn Java loving friend. ▪ Familiar Syntax ▪ Its syntax is familiar to any programmer coming from the OOP domain, and can be more or less understood from the get go. ▪ There are of course some differences from Java such as the reworked constructors or the val var variable declarations.
  5. 5. Continue… ▪ String Interpolation ▪ It’s as if a smarter and more readable version of Java’s String.format() was built into the language. ▪ Type Inference ▪ Kotlin will infer your types wherever you feel it will improve readability: ▪ Smart Casts ▪ The Kotlin compiler tracks your logic and auto-casts types if possible, which means no more instanceof. ▪ Sealed Class ▪ Sealed classes are used for representing restricted class hierarchies, when a value can have one of the types from a limited set, but cannot have any other type. They are, in a sense, an extension of enum classes: the set of values for an enum type is also restricted, but each enum constant exists only as a single instance, whereas a subclass of a sealed class can have multiple instances which can contain state. ▪ Default Arguments ▪ No need to define several similar methods with varying arguments. ▪ Properties ▪ Custom set & get behavior can be added to public fields, which means we can stop bloating our code with mindless getters & setters.
  6. 6. Continue… ▪ The Data Class ▪ It’s a POJO complete with toString(), equals(), hashCode(), and copy(), and unlike in Java it won’t take up 100 lines of code. ▪ Null Safety ▪ Java is what we should call an almost statically typed language. In it, a variable of type String is not guaranteed to refer to a String— it might refer to null. ▪ Even though we are used to this, it negates the safety of static type checking, and as a result Java developers have to live in constant fear of NPEs. ▪ Kotlin resolves this by distinguishing between non-null types and nullable types. ▪ Kotlin Coroutines ▪ Kotlin as a language, provides only minimal low-level APIs in its standard library to enable various other libraries to utilize coroutines. Unlike many other languages with similar capabilities, async and await are not keywords in Kotlin and are not even part of its standard library. Moreover, Kotlin's concept of suspending function provides a safer and less error-prone abstraction for asynchronous operations than futures and promises. ▪ kotlinx.coroutines is a rich library for coroutines developed by JetBrains. It contains a number of high-level coroutine- enabled primitives that including launch, async and others. ▪ IDE Support ▪ You have a number of options if you intend to get started with Kotlin, but I highly recommend using IntelliJ which comes bundled with Kotlin—its features demonstrate the advantage of having the same people design both language and IDE.
  7. 7. Kotlin Support ▪ Kotlin support other platform such as Android, Java script, Web Development with Servlet, REST services etc. ▪ Android ▪ Kotlin is fully supported in Android Studio 3.0, so it's easy to create new projects with Kotlin files, add Kotlin files to your existing project, and convert Java language code to Kotlin. ▪ You can then use of all Android Studio's existing tools with your Kotlin code, such as autocomplete, lint checker, refactoring, debugging, and more. ▪ Intellij provides a nice way to work with Kotlin and Java in single project it called Java interop. ▪ https://developer.android.com/kotlin/index.html
  8. 8. Continue… ▪ Java Script ▪ Kotlin support a java script as well. There are multiple way to compile kotlin to javascript. ▪ The most and recommended approach is to use Gradle. ▪ For more information for project setup refer below link: ▪ http://kotlinlang.org/docs/tutorials/javascript/kotlin-to-javascript/kotlin-to-javascript.html ▪ Web Development ▪ By using Kotlin language we can develop a web application with servlet and create a REST services. ▪ For more information refer below link: ▪ http://kotlinlang.org/docs/tutorials/httpservlets.html ▪ http://kotlinlang.org/docs/tutorials/spring-boot-restful.html
  9. 9. Comparison between Java and Kotlin ▪ In Java some issues are there Kotlin addressed these issues and resolved it. Here are all all those issues which Kotlin has fixed: ▪ Null references are controlled by the type system. ▪ No raw types ▪ Arrays in Kotlin are invariant ▪ Kotlin has proper function types, as opposed to Java's SAM-conversions ▪ Use-site variance without wildcards ▪ Kotlin does not have checked exceptions.
  10. 10. What java has that Kotlin does not? ▪ Checked exceptions ▪ Primitive types that are not classes ▪ Static members ▪ Non-private fields ▪ Wildcard-types
  11. 11. What Kotlin has that Java does not? ▪ Lambda expressions + Inline functions = performance custom control structures ▪ Extension functions ▪ Null-safety ▪ Smart casts ▪ String templates ▪ Properties ▪ Primary constructors ▪ First-class delegation ▪ Type inference for variable and property types
  12. 12. Continue… ▪ Declaration-site variance & Type projections ▪ Range expressions ▪ Operator overloading ▪ Companion objects ▪ Data classes ▪ Separate interfaces for read-only and mutable collections ▪ Coroutines
  13. 13. Thank you Communicate with us… Mobio Solutions LLP 706/B, Ganesh Plaza, Navrangpura, Ahmedabad - 380009, Gujarat, India Phone: +91-9904929149 Email: contact@mobiosolutions.com Web: www.mobiosolutions.com

×