Upgrade to Pro — share decks privately, control downloads, hide ads and more …

From Lean to Kotlin

From Lean to Kotlin

Qonto is growing extremely rapidly and is building its development on some of the key principles of the Lean methodology.
During this presentation we'll go back in time, visit the US and Japan to present some of the tools we sometimes use in our production flow.
Finally we'll present some research we've been doing on Kotlin Native, explaining the technology and knowledge we've gathered.

Avatar for Guillaume Le Roy

Guillaume Le Roy

January 30, 2020

Other Decks in Programming

Transcript

  1. Welcome to Qonto! The bank for Small and Medium businesses

    and freelancers Launched in July 2017 65,000 SME clients in 2019 - Expanded to Spain, Italy and Germany 200 employees in 2020 €136 million raised - largest funding round for a French fintech company Qonto - Hottest startups in Paris (Wired)
  2. Welcome to Qonto! Adapt our service to local businesses in

    Spain, Italy and Germany Provide international business services Prepare support for Google Pay and Apple Pay Bring new Premium cards and associated features And more... Qonto 2020 Q1 roadmap
  3. The origins - Second Industrial Revolution (1870 - 1945) In

    the US, Taylorism and Fordism created factories with long production lines thought by engineers where workers were repeating simple tasks over and over again. From the US to Japan In Japan, after WWII, it was time to rebuild the country with limited men, money and resources. Used Lean principles to improve existing processes, to train and develop people.
  4. Kotlin Multiplatform Study Created in 2011 by Jetbrains, current version

    is 1.3 Modern language, compiled into Java Bytecode so compatible with the JVM Officially supported on Android in 2017 Enables developers to reduce boilerplate code and improve apps quality Kotlin
  5. Kotlin Multiplatform Study Kotlin/Native compiler - Announced in 2017 Can

    compile Kotlin code to native binaries ( .framework), no JVM needed! Can target: Android, iOS, MacOS, watchOS, tvOS etc… Supports two-way interoperability with the native world Kotlin/Native - Welcome to a brand new world!
  6. Kotlin Multiplatform Study An experimental feature in Kotlin 1.3 A

    Single Kotlin project which targets both Android and iOS Based on Gradle Mechanism of “expect/actual” Projects can be created from IntelliJ and Android Studio Kotlin Multiplatform framework - access to platform specific API
  7. HTTP client API model Library interface Klibqonto Our shared library

    Qonto Android app klibqonto.aar Qonto iOS app klibqonto.framework Klibqonto (Kotlin Multiplatform) QONTO API 2 calls Carthage Maven
  8. Klibqonto Verify simple cases (GET, POST, PUT) Ability to use

    a proxy? How to publish artifacts? Logs with various levels Threading model? SSL (supported versions of the protocol, and certificate pinning) Authentication in general, and in particular, automatic token renewal after 401 Multipart (attachment) uploads Error handling and response wrapping in a common "envelope" object Automatic retry after network issue Ability to configure timeout values WebSocket (maybe out of scope for now?) Using the debugger (breakpoints, etc.) in Kotlin native code from XCode and from AS If it works well with Crashlytics if a crash occurs in the Kotlin code Ability to easily switch server address on the fly (prod/staging/mock for UI tests) HTTP2 support Min Android SDK - Min iOS version Things we wanted to verify
  9. Klibqonto Our project structure in Android Studio Android test application

    iOS test application Common library module Common code Use the “expect” keyword iOS specific code Use the “actual” keyword Android Studio IDE
  10. Kotlin Multiplatform The “expect/actual” mechanism - In your Common codebase

    Declare “expected” classes, objects, Types in your common code In CommonMain sourceSet
  11. Kotlin Multiplatform The “expect/actual” mechanism - Date example Declare a

    Date class in our CommonMain sourceSet actual Date class for iOS in our iosMain sourceSet actual Date class for Android In our androidMain sourceSet
  12. Klibqonto Ktor project - made by Jetbrains, current version is

    1.3 (just released) A Kotlin Multiplatform project for building asynchronous servers and clients Uses Kotlin Serialization for Json Ktor framework - an http client library
  13. Klibqonto Back to the app - integration into an iOS

    application Create a user Session Fetch user Memberships In Xcode!
  14. Kotlin Multiplatform - Our learnings Create a simple shared Kotlin

    Native library ✅ Make 2 API calls (POST and GET) to our Qonto API ✅ Create and parse API model objects (Membership, User, Organization) ✅ Build a .framework for iOS & .aar for Android - use them in our applications ✅ What we achieved
  15. Kotlin Multiplatform - Our learnings Clearly still an experimental feature

    Building is slow (slower than regular Kotlin) Lots of bugs…. weird error messages, incompatibilities, differences between Android Studio and IntelliJ Difficulties we met
  16. Kotlin Multiplatform - Our learnings ✅ Verify simple cases (GET,

    POST, PUT) ✅ Ability to use a proxy? with the latest version of Ktor HttpClient (which is an RC2) ✅ How to publish artifacts? With Carthage and Maven ✅ Logs with various levels ✅ Threading model: use coroutines for Kotlin / callbacks for Swift SSL (supported versions of the protocol, and certificate pinning) Authentication in general, and in particular, automatic token renewal after 401 Multipart (attachment) uploads Error handling and response wrapping in a common "envelope" object Automatic retry after network issue Ability to configure timeout values WebSocket (maybe out of scope for now?) Using the debugger (breakpoints, etc.) in Kotlin native code from XCode and from AS If it works well with Crashlytics if a crash occurs in the Kotlin code Ability to easily switch server address on the fly (prod/staging/mock for UI tests) HTTP2 support Min Android SDK - Min iOS version Don’t forget to check your results
  17. Case study conclusion Currently we DON’T recommend using it in

    production It’s too unstable to really reduce development time and reach our target but we’ll keep on eye on its evolutions. Can we halve development lead time with KMP?
  18. • Read our articles on Medium: https://medium.com/qonto-engineering • Keen to

    join us? Go to https://qonto.eu/en/careers Want to know more?