SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Kotlin
A Programming Language
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.
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.
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.
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.
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.
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
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
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.
What java has that Kotlin does not?
▪ Checked exceptions
▪ Primitive types that are not classes
▪ Static members
▪ Non-private fields
▪ Wildcard-types
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
Continue…
▪ Declaration-site variance & Type projections
▪ Range expressions
▪ Operator overloading
▪ Companion objects
▪ Data classes
▪ Separate interfaces for read-only and mutable collections
▪ Coroutines
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

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Go lang
Go langGo lang
Go lang
 
Best Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IBest Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part I
 
Kotlin presentation
Kotlin presentation Kotlin presentation
Kotlin presentation
 
Grokking Techtalk #37: Software design and refactoring
 Grokking Techtalk #37: Software design and refactoring Grokking Techtalk #37: Software design and refactoring
Grokking Techtalk #37: Software design and refactoring
 
Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)Std 12 computer chapter 6 object oriented concepts (part 1)
Std 12 computer chapter 6 object oriented concepts (part 1)
 
Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | Edureka
 
C# basics
 C# basics C# basics
C# basics
 
Low Code Application Development Platform
Low Code Application Development PlatformLow Code Application Development Platform
Low Code Application Development Platform
 
Intro to kotlin
Intro to kotlinIntro to kotlin
Intro to kotlin
 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handling
 
Kotlin Language powerpoint show file
Kotlin Language powerpoint show fileKotlin Language powerpoint show file
Kotlin Language powerpoint show file
 
C# in depth
C# in depthC# in depth
C# in depth
 
DOT Net overview
DOT Net overviewDOT Net overview
DOT Net overview
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
 
Static typing vs dynamic typing languages
Static typing vs dynamic typing languagesStatic typing vs dynamic typing languages
Static typing vs dynamic typing languages
 
CS3391 OOP UT-I T3 FEATURES OF OBJECT ORIENTED PROGRAMMING
CS3391 OOP UT-I T3 FEATURES OF OBJECT ORIENTED PROGRAMMINGCS3391 OOP UT-I T3 FEATURES OF OBJECT ORIENTED PROGRAMMING
CS3391 OOP UT-I T3 FEATURES OF OBJECT ORIENTED PROGRAMMING
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
 
Dart ppt
Dart pptDart ppt
Dart ppt
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#
 

Ähnlich wie Kotlin - A Programming Language

Ähnlich wie Kotlin - A Programming Language (20)

Kotlin
KotlinKotlin
Kotlin
 
Kotlin vs Java-A Comparison for Application Development Projects.pdf
Kotlin vs Java-A Comparison for Application Development Projects.pdfKotlin vs Java-A Comparison for Application Development Projects.pdf
Kotlin vs Java-A Comparison for Application Development Projects.pdf
 
Coding in kotlin
Coding in kotlinCoding in kotlin
Coding in kotlin
 
Coding in kotlin
Coding in kotlinCoding in kotlin
Coding in kotlin
 
A short introduction to the Kotlin language for Java developers
A short introduction to the Kotlin language for Java developersA short introduction to the Kotlin language for Java developers
A short introduction to the Kotlin language for Java developers
 
What's new with Kotlin - Google IO18' extended Covenant University.
What's new with Kotlin - Google IO18' extended Covenant University.What's new with Kotlin - Google IO18' extended Covenant University.
What's new with Kotlin - Google IO18' extended Covenant University.
 
Kotlin vs Java: Choosing The Right Language
Kotlin vs Java: Choosing The Right LanguageKotlin vs Java: Choosing The Right Language
Kotlin vs Java: Choosing The Right Language
 
Kotlin
KotlinKotlin
Kotlin
 
Introduction to Kotlin - Android KTX
Introduction to Kotlin - Android KTXIntroduction to Kotlin - Android KTX
Introduction to Kotlin - Android KTX
 
Kotlin Vs Java A Comparison For Application Development Projects.pdf
Kotlin Vs Java A Comparison For Application Development Projects.pdfKotlin Vs Java A Comparison For Application Development Projects.pdf
Kotlin Vs Java A Comparison For Application Development Projects.pdf
 
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdfLearn Kotlin and Build Robust Android Apps with Bcoder.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
 
Kotlin for Android
Kotlin for AndroidKotlin for Android
Kotlin for Android
 
Say Goodbye To Java: Getting Started With Kotlin For Android Development
Say Goodbye To Java: Getting Started With Kotlin For Android DevelopmentSay Goodbye To Java: Getting Started With Kotlin For Android Development
Say Goodbye To Java: Getting Started With Kotlin For Android Development
 
Kotlin vs Java- Finding The All-Time Favorite Fit!
Kotlin vs Java- Finding The All-Time Favorite Fit!Kotlin vs Java- Finding The All-Time Favorite Fit!
Kotlin vs Java- Finding The All-Time Favorite Fit!
 
Is this Swift for Android? A short introduction to the Kotlin language
Is this Swift for Android? A short introduction to the Kotlin languageIs this Swift for Android? A short introduction to the Kotlin language
Is this Swift for Android? A short introduction to the Kotlin language
 
Kotlin
KotlinKotlin
Kotlin
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Introduction_to_Kotlin.pptx
Introduction_to_Kotlin.pptxIntroduction_to_Kotlin.pptx
Introduction_to_Kotlin.pptx
 
Kotlin App Development Tips.pdf
Kotlin App Development Tips.pdfKotlin App Development Tips.pdf
Kotlin App Development Tips.pdf
 
Kotlin vs Java: Which is Better for Android App Development?
Kotlin vs Java: Which is Better for Android App Development?Kotlin vs Java: Which is Better for Android App Development?
Kotlin vs Java: Which is Better for Android App Development?
 

Mehr von Mobio Solutions

Transforming Business With Mastering Server-Side Rendering In React JS
Transforming Business With Mastering Server-Side Rendering In React JSTransforming Business With Mastering Server-Side Rendering In React JS
Transforming Business With Mastering Server-Side Rendering In React JS
Mobio Solutions
 

Mehr von Mobio Solutions (20)

The Low-Code Revolution: Transforming BFSI
The Low-Code Revolution: Transforming BFSIThe Low-Code Revolution: Transforming BFSI
The Low-Code Revolution: Transforming BFSI
 
Digital Transformation & Data Security in Insurance Sector
Digital Transformation & Data Security in Insurance SectorDigital Transformation & Data Security in Insurance Sector
Digital Transformation & Data Security in Insurance Sector
 
Inside a Financial Giant's Employee Experience Revolution & Boosting Customer...
Inside a Financial Giant's Employee Experience Revolution & Boosting Customer...Inside a Financial Giant's Employee Experience Revolution & Boosting Customer...
Inside a Financial Giant's Employee Experience Revolution & Boosting Customer...
 
A Breakthrough in Cost Reduction and Response Time with Innovative Web Techno...
A Breakthrough in Cost Reduction and Response Time with Innovative Web Techno...A Breakthrough in Cost Reduction and Response Time with Innovative Web Techno...
A Breakthrough in Cost Reduction and Response Time with Innovative Web Techno...
 
Globalization and its Influence on Modern-day Logistics and Supply Chains
Globalization and its Influence on Modern-day Logistics and Supply ChainsGlobalization and its Influence on Modern-day Logistics and Supply Chains
Globalization and its Influence on Modern-day Logistics and Supply Chains
 
Smart Asset Management Solutions for Modern UK Businesses
Smart Asset Management Solutions for Modern UK BusinessesSmart Asset Management Solutions for Modern UK Businesses
Smart Asset Management Solutions for Modern UK Businesses
 
Transforming Warehouse Operations: The Power of IT Solutions
Transforming Warehouse Operations: The Power of IT SolutionsTransforming Warehouse Operations: The Power of IT Solutions
Transforming Warehouse Operations: The Power of IT Solutions
 
The Power of React Native UI Libraries in App Development
The Power of React Native UI Libraries in App DevelopmentThe Power of React Native UI Libraries in App Development
The Power of React Native UI Libraries in App Development
 
The Role of Mobile Apps in Wind Farm Management
The Role of Mobile Apps in Wind Farm ManagementThe Role of Mobile Apps in Wind Farm Management
The Role of Mobile Apps in Wind Farm Management
 
Custom Software's Role in Integrating Multi-modal Logistics Operations
Custom Software's Role in Integrating Multi-modal Logistics OperationsCustom Software's Role in Integrating Multi-modal Logistics Operations
Custom Software's Role in Integrating Multi-modal Logistics Operations
 
Navigating the Future of Business Top UXUI Trends
Navigating the Future of Business Top UXUI TrendsNavigating the Future of Business Top UXUI Trends
Navigating the Future of Business Top UXUI Trends
 
Understanding Generative AI in Software Development
Understanding Generative AI in Software DevelopmentUnderstanding Generative AI in Software Development
Understanding Generative AI in Software Development
 
How To Leverage Web Applications To Drive Operational Efficiency In Business
How To Leverage Web Applications To Drive Operational Efficiency In BusinessHow To Leverage Web Applications To Drive Operational Efficiency In Business
How To Leverage Web Applications To Drive Operational Efficiency In Business
 
Leveraging Technology for a Sustainable Future To Businesses ROI
Leveraging Technology for a Sustainable Future To Businesses ROILeveraging Technology for a Sustainable Future To Businesses ROI
Leveraging Technology for a Sustainable Future To Businesses ROI
 
9 Steps To Choosing The Perfect Software Development Partner For Your Startup
9 Steps To Choosing The Perfect Software Development Partner For Your Startup9 Steps To Choosing The Perfect Software Development Partner For Your Startup
9 Steps To Choosing The Perfect Software Development Partner For Your Startup
 
The 10 Commandments Security Of Mobile App Development
The 10 Commandments Security Of Mobile App DevelopmentThe 10 Commandments Security Of Mobile App Development
The 10 Commandments Security Of Mobile App Development
 
How Web Application Development Shapes The Future Of Enterprises
How Web Application Development Shapes The Future Of EnterprisesHow Web Application Development Shapes The Future Of Enterprises
How Web Application Development Shapes The Future Of Enterprises
 
Modernizing Insurance Operations Leverage Technology For Peak Efficiency
Modernizing Insurance Operations Leverage Technology For Peak EfficiencyModernizing Insurance Operations Leverage Technology For Peak Efficiency
Modernizing Insurance Operations Leverage Technology For Peak Efficiency
 
Agile in Action: Achieving Startup Product Development Success With Mobio Sol...
Agile in Action: Achieving Startup Product Development Success With Mobio Sol...Agile in Action: Achieving Startup Product Development Success With Mobio Sol...
Agile in Action: Achieving Startup Product Development Success With Mobio Sol...
 
Transforming Business With Mastering Server-Side Rendering In React JS
Transforming Business With Mastering Server-Side Rendering In React JSTransforming Business With Mastering Server-Side Rendering In React JS
Transforming Business With Mastering Server-Side Rendering In React JS
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Kotlin - A Programming Language

  • 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. 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. 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. 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. 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. 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. 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. 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. What java has that Kotlin does not? ▪ Checked exceptions ▪ Primitive types that are not classes ▪ Static members ▪ Non-private fields ▪ Wildcard-types
  • 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. Continue… ▪ Declaration-site variance & Type projections ▪ Range expressions ▪ Operator overloading ▪ Companion objects ▪ Data classes ▪ Separate interfaces for read-only and mutable collections ▪ Coroutines
  • 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