laravel logo

Local Scopes In Laravel

February 28, 2019
ionic framework

Reusable Components And RxJS Observables In Ionic-Angular

April 8, 2019

Android: A Quick Kotlin Eksperience

April 4, 2019 / Brad Mc Helem

 

Benefits of using Kotlin

 

Original Presentation: Android – A quick Kotlin Eksperience

1.No Semi-Colon

2.Default Values

3.Extension Functions

4.Data Classes

5.Parcelize

6.Unit Functions

7.Null Operations

 

No Semicolons

 

This is probably the thing smallest things but has a huge effect on readability of code. A couple things to note is that there’s no new keyword and you don’t need to declare the type.

code

code

 

Default Values


 

Data Classes – Code

=

 

Kotlin data class benefits

 

1.The properties declared in the constructor: this technically is not exclusive to a data class, but it avoids all the boilerplate of getters and setters, in addition to the constructor

2.Provides the equals() & hashCode() functions

3.Provides a copy() method, very useful when we use immutable objects.

 

Parcelize – Code

=

 

The old implementation of Parcelize, required you to write a writeToParcelize class and create a new Creator class and was generally more work than it should have been. The more parameters you had in the Model Class the longer your code would inevitably become

 

Extension Functions – Code

code

 

Extension Function Usage

code

 

Unit functions

code

 

Null Operators

code

Share

Brad Mc Helem

✕
Android: A Quick Kotlin Eksperience
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.
Read more