Code Monkey home page Code Monkey logo

hello-kotlin's Introduction

This is a playground for Kotlin development.

Best Kotlin features:

  • properties instead of fields
    • no more getter/setter functions
    • property delegation
  • null safe types
    • compiler enforces null safety
    • always know when you need to check
    • smart casting after checking for null
    • better operators: ?. !!. ?:
  • type inference
    • less boiler plate code
    • (please use in moderation)
  • better function calls
    • default values
    • named arguments
    • last argument can be written outside () if lambda function
  • destructuring
    • assign components of an instance into several variables - val (name, age) = person
  • extension functions
    • enhance class functionality even if you have no control over the code
  • operator overloading
    • useful for equality and comparisons (== != and < <= > >=)
    • useful for math classes (+ - * / % ! .. ++ -- += ...)
    • useful for containers and DSL ((), [])
    • (please use in moderation)
  • compact class declarations
    • constructor with properties as part of class declaration
    • classes are final per default (use open or sealed)
  • enforced primary constructors
    • secondary constructor must end up calling the single primary constructor
  • good handling of immutable vs. mutable states
    • language design is biased in favor of immutability
    • mutable and immutable collection classes
  • improved generics
    • in and out instead of producer-extends and consumer-super
    • use reified to prevent type erasure in inline functions
  • language allows designing nice DSLs
    • generally less clutter (see all of the above)
    • lambda function with receiver
    • single lambda argument can be omitted
    • infix functions
  • ... many others ...

hello-kotlin's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.