Kotlin For Beginners : Part 1

Akshay Shah
2 min readAug 13, 2018

--

The What and Why ?

Kotlin is a statically typed programming language. This means the type of every expression in a program is known at compile time, and the compiler can validate that the methods and fields you’re trying to access exist on the objects you’re using.

Benefits of static typing:

  • Performance — Calling methods is faster because there’s no need to figure out at runtime which method needs to be called.
  • Reliability — The compiler verifies the correctness of the program, so there are fewer chances for crashes at runtime.
  • Maintainability — Working with unfamiliar code is easier because you can see what kind of objects the code is working with.
  • Tool support — Static typing enables reliable refactorings, precise code completion, and other IDE features.

Functional Programming

  • First-class functions — You work with functions (pieces of behavior) as values. You can store them in variables, pass them as parameters, or return them from other functions.
  • Immutability — You work with immutable objects, which guarantees that their state can’t change after their creation.
  • No side effects — You use pure functions that return the same result given the same inputs and don’t modify the state of other objects or interact with the outside world.

Kotlin Functional Features

  • Functional types, allowing functions to receive other functions as parameters or return other functions.
  • Lambda expressions, letting you pass around blocks of code with minimum boilerplate Data classes, providing a concise syntax for creating immutable value objects
  • A rich set of APIs in the standard library for working with objects and collections in the functional style

Kotlin is pragmatic, safe, concise, and interoperable, meaning it focuses on using proven solutions for common tasks, preventing common errors such as `NullPointerException`s, supporting compact and easy-to-read code, and unrestricted integration with Java.

Hello World!

fun main(args: Array<String>){ println(“Hello, world!”) }

Part 2

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Akshay Shah
Akshay Shah

Written by Akshay Shah

Lead Software Engineer @ EPAM Systems |Android | Kotlin | KMM

No responses yet

Write a response