Skip to main content

Kotlin ( a new programming language) for Android Development



Kotlin is a statically-typed programming language that runs on the Java Virtual Machine and also can be compiled to JavaScript source code or uses the LLVM compiler infrastructure. Its primary development is from a team of JetBrains programmers based in Saint Petersburg.
The name comes from Kotlin Island, near St. Petersburg. Andrey Breslav mentioned that the team decided to name it after an island just like Java was named after the Indonesian island of Java.
Google just announced that it will officially support Kotlin on Android as a “first-class” language.

Kotlin tools will be included with Android Studio 3.0 by default, and JetBrains and Google are pledging to support the language going forward. Kotlin as a language has a lot of similarities to Java in structure — it's object oriented and statically typed, and designed for similar problems Java solves. But because it's a clean slate in many ways, Kotlin adds a lot of nice-to-have features, a much cleaner syntax, ideas from functional programming, and other enhancements over Java.


Using Kotlin for Android Development

Kotlin is a great fit for developing Android applications, bringing all of the advantages of a modern language to the Android platform without introducing any new restrictions:
·         Compatibility: Kotlin is fully compatible with JDK 6, ensuring that Kotlin applications can run on older Android devices with no issues. The Kotlin tooling is fully supported in Android Studio and compatible with the Android build system.
·         Performance: A Kotlin application runs as fast as an equivalent Java one, thanks to very similar bytecode structure. With Kotlin's support for inline functions, code using lambdas often runs even faster than the same code written in Java.
·         Interoperability: Kotlin is 100% interoperable with Java, allowing using all existing Android libraries in a Kotlin application. This includes annotation processing, so databinding and Dagger work too.
·         Footprint: Kotlin has a very compact runtime library, which can be further reduced through the use of ProGuard. In a real application, the Kotlin runtime adds only a few hundred methods and less than 100K to the size of the .apk file.
·         CompilationTime: Kotlin supports efficient incremental compilation, so while there's some additional overhead for clean builds, incremental builds are usually as fast or faster than with Java.
·         Learning Curve: For a Java developer, getting started with Kotlin is very easy. The automated Java to Kotlin converter included in the Kotlin plugin helps with the first steps. Kotlin Koans offer a guide through the key features of the language with a series of interactive exercises.




Packages

A source file may start with a package declaration:

package foo.bar
 
fun baz() {}
 
class Goo {}
 
// ...
All the contents (such as classes and functions) of the source file are contained by the package declared. So, in the example above, the full name of baz() is foo.bar.baz, and the full name of Goo is foo.bar.Goo.
If the package is not specified, the contents of such a file belong to "default" package that has no name.

A number of packages are imported into every Kotlin file by default:
·         kotlin.*
·         kotlin.annotation.*
·         kotlin.collections.*
·         kotlin.comparisons.* (since 1.1)
·         kotlin.io.*
·         kotlin.ranges.*
·         kotlin.sequences.*
·         kotlin.text.*

Additional packages are imported depending on the target platform:
·         JVM:
o    java.lang.*
o    kotlin.jvm.*
·         JS:
o    kotlin.js.*

The Kotlin Standard Library provides living essentials for everyday work with Kotlin. These include:
·         Higher-order functions implementing idiomatic patterns (letapplyusesynchronized, etc).
·         Extension functions providing querying operations for collections (eager) and sequences (lazy).
·         Various utilities for working with strings and char sequences.
·         Extensions for JDK classes making it convenient to work with files, IO, and threading

Packages

kotlin
Core functions and types, available on all supported platforms.
kotlin.annotation
Library support for the Kotlin annotation facility.
kotlin.browser
JS
Access to top-level properties (documentwindow etc.) in the browser environment.
kotlin.collections
Collection types, such as IterableCollectionListSetMap and related top-level and extension functions.
kotlin.comparisons
Helper functions for creating Comparator instances.
kotlin.concurrent
JVM
Utility functions for concurrent programming.
kotlin.coroutines.experimental
1.1
Library support for coroutines, including support for lazy sequences.
kotlin.coroutines.experimental.intrinsics
1.1
Low-level building blocks for libraries that provide coroutine-based APIs.
kotlin.dom
JS
Utility functions for working with the browser DOM.
kotlin.experimental
1.1
Experimental APIs, subject to change in future versions of Kotlin.
kotlin.io
IO API for working with files and streams.
kotlin.js
JS
Functions and other APIs specific to the JavaScript platform.
kotlin.jvm
JVM
Functions and annotations specific to the Java platform.
kotlin.properties
Standard implementations of delegates for delegated properties and helper functions for implementing custom delegates.
kotlin.ranges
Ranges, Progressions and related top-level and extension functions.
kotlin.reflect
Runtime API for Kotlin reflection
kotlin.reflect.full
JVM
1.1
Extensions for Kotlin reflection provided by kotlin-reflectlibrary.
kotlin.reflect.jvm
JVM
Runtime API for interoperability between Kotlin reflection and Java reflection provided by kotlin-reflect library.
kotlin.sequences
Sequence type that represents lazily evaluated collections. Top-level functions for instantiating sequences and extension functions for sequences.
kotlin.streams
JVM
1.1
JRE8
Utility functions for working with Java 8 streams.
kotlin.system
JVM
System-related utility functions.
kotlin.text
Functions for working with text and regular expressions.
org.khronos.webgl
JS
Kotlin JavaScript wrappers for the WebGL API.
org.w3c.dom
JS
Kotlin JavaScript wrappers for the DOM API.
org.w3c.dom.css
JS
Kotlin JavaScript wrappers for the DOM CSS API.
org.w3c.dom.events
JS
Kotlin JavaScript wrappers for the DOM events API.
org.w3c.dom.parsing
JS
Kotlin JavaScript wrappers for the DOM parsing API.
org.w3c.dom.svg
JS
Kotlin JavaScript wrappers for the DOM SVG API.
org.w3c.dom.url
JS
Kotlin JavaScript wrappers for the DOM URL API.
org.w3c.fetch
JS
Kotlin JavaScript wrappers for the W3C fetch API.
org.w3c.files
JS
Kotlin JavaScript wrappers for the W3C file API.
org.w3c.notifications
JS
Kotlin JavaScript wrappers for the Web Notifications API.
org.w3c.performance
JS
Kotlin JavaScript wrappers for the Navigation Timing API.
org.w3c.workers
JS
Kotlin JavaScript wrappers for the Web Workers API.
org.w3c.xhr
JS
Kotlin JavaScript wrappers for the XMLHttpRequest API.

For more information, please visit: http://www.osglsofttech.com
Mobile: +91-8650030309, 8650030308, info@osglsofttech.com


Address: Shanti Vihar, Behind Mahindra Showroom, Ajabpur Khurd, Dehradun

Comments

Popular posts from this blog

Why use an Inventory Management System?

Inventory management   software is a computer-based   system  for tracking   inventory  levels, orders, sales and deliveries. It can also be   used  in the manufacturing industry to create a work order, bill of materials and other production-related documents. Inventory  control is also  important  to maintaining the right balance of stock in your warehouses. You don't want to lose a sale because you didn't have enough  inventory  to fill an order. ... Too much  inventory  can trigger profit losses––whether a product expires, gets damaged, or goes out of season. ·          Real-Time Inventory by Category & Location Real time inventory provides comprehensive information’s in a format you currently use within a minute of the physical audit to be completed.   Real-Time Inventory   Control Software package allows you to manage all aspects of you...

Why Mobile Apps are Better Than Mobile Websites

The   number of mobile users  today is greater than the number of desktop users! Consequently, businesses have realized the need to effectively use mobile channels for attracting customers. They have started new operations (or scaled existing ones) through mobile websites and mobile apps. While businesses with large wallets can afford to employ both mobile websites and apps , other companies might have to choose one of them. The choice between mobile apps and websites depends on their cost, usability, required features and the audience they serve. That being said,  studies show  that users prefer mobile apps more than mobile websites . This makes for a strong reason to have mobile apps for reaching out to potential (and existing) customers. ·         Mobile Apps Offer Better Personalization Personalization is about offering tailored communication to users based on their interests, location, usage behavior, and more. Wi...

Learn New Programming Languages Groovy, Rust, Elixir, Go

Groovy Groovy  is an  object-oriented scripting language  that was created by Apache  for the Java platform . It appeared first in 2003, however the first stable release (Groovy 1.0) came out only in 2007. Since then, it has been used by companies such as  Netflix, Linkedin, Airbus, and Mastercard . Groovy is  dynamically compiled to Java bytecode , therefore it  seamlessly integrates with any Java library . If you’ve already programmed in Java or any other language that  uses the curly-bracket syntax  you can  learn Groovy relatively quickly . As Groovy is  open-source , you can find the  source code on Github , or you can contribute to the project yourself if you want. Although Groovy is usually praised because it  increases developers’ productivity ,  access to the Grails Web Application Framework  can also be a good reason to give a closer look to it. Grails was initially called  “...