Kotlin Intro & Starting the Koans

20th August 2018



Drone Delivery App
Why learn Kotlin?
-
Kotlin is a better language for the JVM than Java
- Really easy to get up and running
- Simpler language than Java
-
Much safer than Java
-
No more NullPointerExceptions!
-
Streamlines the handling of null values
-
-
More more clean & concise than Java
-
100% Interoperable with Java
-
Kotlin & Java classes can live side by side
-
The Plan

Different Components
-
Android Controller
-
Drone Controller & Delivery Service
-
Food Service & Consumer Service
-
Android Consumer App
-
Merchant Web App
Android Controller
-
Control drone with existing android app
-
Take off, Land
-
Control pitch, yaw, roll, etc.
-
-
This is already provided in the Parrot SDK
-
We want to convert it to kotlin
Drone Controller & Delivery Service
-
Send higher level commands to drone
-
-
Move one unit in any direction
-
Fly to coordinate (x, y)
-
Need a higher level android UI to test
-
-
Can eventually be used for handling delivery requests and scheduling.
Food Service & Consumer Service
-
Embedded Web Servers
-
Handle http requests
-
Async framework would be nice (Ktor)
-
Other option seems like nanohttpd
Android Consumer App
-
Interacts with consumer-service
-
Get delivery options
-
Send delivery requests
-
Merchant Web App
-
Interacts with food-service
-
Tells food-service where food is available
-
Written in Kotlin and compiled to Javascript
Implementing drone commands
Requires pauses in code
-
e.g. fly forward for one second
Does Kotlin have any awesome way to implement pauses?
What are coroutines?
Coroutines
-
Super Lightweight threads
-
Really cheap (almost free)
-
Experimental in 1.1 (will change)
provide a way to avoid blocking a thread and replace it with a cheaper and more controllable operation: suspension of a coroutine
Kotlin Coroutines & Drone Commands
By Tom Hanley
Kotlin Coroutines & Drone Commands
- 85