Touchlab KotlinConf 2019 Recap

Touchlab KotlinConf 2019 Recap

Touchlab attended KotlinConf 2019 in Copenhagen, Denmark. As anticipated, the conference was a milestone event for the development of Kotlin Multiplatform and its community of practitioners and contributors.

VIDEOS! There will most likely be ‘official’ videos published soon, but the content is already up in the live stream so we organized links to each talk for you.

This post also contains reactions to Kotlin Multiplatform sessions attended by Touchlab’s Ben Whitley (multiplatform mobile engineer with iOS background) and Kevin Galligan (Partner).

Before we jump in, we’d like to call out two important moments from the conference:

1. During his keynote, Kotlin Lead Language Designer Andrey Breslav highlighted Touchlab as a critical community member to JetBrains’ mission to usher in a new era of mobile development with Kotlin Multiplatform (view clip).

2. During the closing Q&A panel an audience member asked about approaches for getting iOS developers onboard for a KMP pilot. JetBrains’ VP of Developer Advocacy Hadi Hariri recommended organizations speak to Touchlab as we’re actively working with clients on this exact topic (view clip).

Thursday Kotlinconf 2019 Recap

Opening Keynote by Andrey Breslav (view keynote)

 

Pre conference take

The KotlinConf keynote is must watch for anybody that’s interested in Kotlin. Any major new stuff will be announced.

Ben’s reaction

  •  Think of Kotlin as an entire ecosystem, not just a language. 
  • The goal is to make Kotlin the default language for starting any project and make it a universal solution for every platform. For any and all levels of experience, platforms, scales, and application.
  • Dropped the term “full-stack Kotlin” which I personally hadn’t heard before.
  • No major new features in Kotlin 1.4. Focus is on quality and performance, which is smart, given the current build times. 

 

Kevin’s reaction

  • They are very focused on making Multiplatform a reality. 
  • You’ll be able to run/debug native iOS apps from Android Studio. That will be a huge adoption driver.  
  • 1.4 will bring a lot of stability and performance/compiler improvements, which will be a big deal.

Sharing Is Caring – Kotlin Multiplatform for Android Developers by Britt Barak (view talk + slides

Pre conference take

This will be a good intro talk. It includes not only native, but JS and backend code.

Ben’s reaction

  • Getting started (aka project configuration and setup) is currently the biggest pain point. Something we can probably all agree on. 
  • Big plurality of different needs, and therefore different architectures. This is still an open ended issue for KMP, and one we’re very familiar with at Touchlab. Because there’s many different use cases and it’s still open ended, this wasn’t intended as a talk on KMP architecture.
  • https://github.com/aakira/kotlin-multiplatform-libraries is a very cool resource to find packages
  • Overall a really good getting started talk, even though a lot of it was very familiar for us at Touchlab.
  • I’d strongly recommend checking out the video of it for Android developers interested in KMP. 

 

MPP in 1.3.X and beyond by Dmitry Savvinov and Liliia Abdulina (view talk)

Pre conference take 

Another KMP intro, from JetBrains engineers

Ben’s reaction

  • Future goal is a complete KMP ecosystem
  • A lot of the talk was a history of KMP through Kotlin versions up until this point
  • Included a shoutout to Touchlab

 

Kevin’s reaction

  • For the future they’re going to focus on docs and onboarding much more, as well as for specific use cases like native mobile. The team had been much more focused on “general” multiplatform.
  • The original discussion of “multiplatform” started in 2016, which is around when Kotlin JVM was 1.0. JS has been around and in use significantly longer than native.

Coroutines! Gotta catch ‘em all! by Florina Muntenescu and Manuel Vivo (view talk)

  

Pre conference take

Concurrency for native will be mostly centered around coroutines, so an intro to coroutines is valuable.

Kotlin Multiplatform in Action: more than 10 projects for iOS and Android with Shared code by Alexandr Pogrebnyak (view talk)

 

Pre conference take

IceRock has been shipping KMP for a while, and has published templates and libraries to help. This will probably be a useful talk for practical KMP advice.

Kevin’s reaction

  • Have released a set of libraries targeted at native mobile development that we should review for use on projects
  • They have a shared UI library for native mobile. Uses native widgets to render. That’s a lot of work to build but assuming we can mix with fully native screens, this is something we’ll be taking a look at.

Bridge the physical world: Kotlin/Native on Raspberry PI by Qian Jin (view talk)

 

Pre conference take

More Kotlin Native. It’s being deployed to an IOT device, which may be interesting to see.

Your multiplatform Kaptain has arrived by Ahmed El-Helw (view talk)

Pre conference take

Careem is shipping KMP in a major platform. This is critical info for orgs getting serious about KMP. We’ll be there for sure.

Ben’s reaction

  • Very early users of KMP
  • KMP exciting and nerve-wracking for management
  • Communication processes were a solution to problems between iOS and Android teams
  • This is a very good “lessons learned” type of talk
  • Shoutout to Touchlab generics patch and Kevin’s blog post about generics 
  • Mentioned basically everything Kevin has put out there at this point, including CrashKiOS and Xcode Plugin. 
  • Ended with a cool/funny poem (last pic)

Shipping a Mobile Multiplatform Project on iOS & Android by Ben Asher and Alec Strong (view talk)

 

Pre conference take

More KMP-in-production experts. We work directly with the Square team doing this, and chat often with Ben, so we’re very much looking forward to see what they have to say.

Ben’s reaction

  • High initial setup cost for KMP, will be worth the effort
  • Features develop parity even if they start out the same (or similar). Good point, not discussed enough
  • Shout-out to Kevin’s concurrency talk. They recommend doing the suspend and lambda methodology (which is what we do pretty regularly).
  • Pros and cons of monorepo, which is under discussed good con for iOS devs: they often don’t even have JVM.
  • Didn’t mention Touchlab CrashKiOS, which is exactly what they need for the improved crash reporting they want. 

 

Kevin’s reaction

  • Square and PlanGrid are some of the earliest shipping apps, and have really had to figure out a bunch of the stuff.
  • I’ve been involved directly with Square, and have worked a fair bit with Ben because they ship on Windows, so we’ve been publishing our libraries to Windows.
  • Great thoughts for introducing your team to and educating your team on KMP.
  • Pick something that the teams don’t like and/or that’s fairly critical and needs to run the same. Sync for PlanGrid and transaction search for Cash.
  • Stopped taking notes because my talk was happening after theirs

 

Kotlin Native Concurrency Explained by Kevin Galligan 
(view talk + slides)

 

Links included in Kevin’s talk

Pre conference take

If you want to do KMP on native, you need to understand concurrency. This is our talk, and a must see, obviously

Friday Kotlinconf 2019 Recap

I Walk The Line: What Parts Of An App Should be in Kotlin Native – and What Parts Shouldn’t? by Ellen Shapiro (view talk)

 

Pre conference take

Ellen knows mobile tech, and brings a lot of iOS experience to the KMP equation. We’re definitely checking this talk out.

Ben’s reaction

  • Developer enthusiasm is key to adoption of cross platform products
  • Gave away copies of Ray Wenderlich Kotlin book to people who ask interesting questions – good idea for engagement
  • Ellen came up with MVSP (Model ViewState Presenter) architecture to replace MVP. It’s a form of unidirectional data flow partially inspired by SwiftUI
  • Shoutout to Kevin’s talk yesterday, she said “it goes into a ton of detail” 
  • Know why you’re using Kotlin Multiplatform, that will dictate how much and what KMP you should do

Going Native: How I Used Kotlin Native to Port 6 Years of Android Games to iOS in 6 Months by Ana Redmond (view talk)

 

Pre conference take

Ana got into native early on and has done very interesting work. This will be a really good talk.

 

Ben’s reaction

  • Ana is a perfect example of what Kevin (and Ellen in her talk) says: if you’re going to do cross platform or common code, know why you’re doing it. 
  • She’s using KMP for shared UIs; very difficult and impressive. As she says, this is possible because of few external dependencies (basically none), which is why this is a good use case for shared UI.
  • She wrote her own KMP WeakRef wrapper to avoid retain cycles in iOS, pretty smart and cool. Has its limitations, won’t catch retain cycles across KMP and native code. 
  • Lessons learned
    • Classes > Objects: to avoid the threading and mutability issues that Kevin’s always talking about
    • Lists > Arrays: this is vindicating as I’ve found this myself and I’ve been saying it for a while now
    • Initialization order: she found very weird behavior in overriding initializers in KMP. See corresponding pic. Something we’ll be looking into at Touchlab. 

Effective Kotlin-Swift Interoperability by John Rodriguez (view talk)

 

Pre conference take

Kotlin/Swift communication is a huge topic for KMP. Improving the situation for iOS developers will be critical for adoption, so this is a critical topic to understand.

Kevin’s reaction

  • Went very deep on interop details. I learned some new things, especially WRT enums.

Kotlin/Native: Answers Your Won’t Find on the Internet
by 
Eugenio Marletti (view talk)

 

Pre conference take

Eugenio is a member of the JetBrains developer relations team, focused on KMP and native. He’s going to be critical to improving the documentation and onboarding experience, so you should definitely check this talk out.

We hope you enjoyed our Kotlinconf 2019 recap

Kotlin Multiplatform Sessions Touchlab is Attending at KotlinConf 2019

Kotlin Multiplatform Sessions Touchlab is Attending at KotlinConf 2019

Touchlab will be attending KotlinConf 2019 in Copenhagen, Denmark. We anticipate the conference to be a milestone event for the development of Kotlin Multiplatform and its community of practitioners and contributors.

If you’re in town, please let us know because we’d love to meet with you.

If you’re unable to attend the conference, no worries. We’re hosting a Kotlin Multiplatform Fireside Chat in New York City for engineering managers. We’ll discuss and review all the KMP updates from the 2019 conference. Register here.

The following is a list of KMP talks we’ll be attending. If you’d like to be notified when the live stream for these sessions is available, register on the KotlinConf website.

Day 2 (Thursday, December 5th)

Opening Keynote by Andrey Breslav  

Time: 9:00 – 10:00

Our take: The KotlinConf keynote is must watch for anybody that’s interested in Kotlin. Any major new stuff will be announced.

Day 3 (Friday, December 6th)

Kotlin Multiplatform Library

Kotlin Multiplatform Library

The following blog post is an overview on Kotlin Multiplatform libraries by the KMP experts, Touchlab. You’ll find a. list of recommended libraries we use today for Kotlin Multiplatform development (including some of our own) b. video recording of Kevin presenting at Øredev 2019 on library development for Kotlin Multiplatform and c. slides from that presentation. 

What Kotlin Multiplatform libraries is Touchlab using today? 

Kotlin Multiplatfom library by KMP experts Touchlab. 

 

Touchlab’s Kotlin Multiplatform library:

  • Stately: Stately is a state utility library to facilitate state management in Kotlin Multiplatform.
  • SQLiter: Sqlite driver for Kotlin Native
  • xcode-kotlin: Xcode plugin for Kotlin debugging and source formatting

Jetbrains’ Kotlin Multiplatform library:

Community Kotlin Multiplatform Libraries We Use

  • Multiplatform Settings: A Kotlin Multiplatform library for saving simple key-value data
  • SqlDelight: Multiplatform SQLite model facilitation library.
  • Koin: Service Locator/DI. Multiplatform in progress.

Kotlin Multiplatform Libraries We Find Interesting

Sample Apps

Kotlin Multiplatform Library Development – Kevin Galligan

Kotlin Multiplatform Library Slideshow – Kevin Galligan

Useful introduction to Kotlin Multiplatform resources 

Kotlin Multiplatform Frequently Asked Questions

Kotlin Multiplatform Frequently Asked Questions

Can I use Kotlin Multiplatform for an existing app? 

Sam: Yes, being able to optionally share even small parts of your application lets you plug KMP in where it makes the most sense for you.

What Kotlin Multiplatform libraries is Touchlab using today? 

Touchlab’s libraries

  • Stately: Stately is a state utility library to facilitate state management in Kotlin Multiplatform.
  • SQLiter: Sqlite driver for Kotlin Native
  • xcode-kotlin: Xcode plugin for Kotlin debugging and source formatting

Jetbrains’ libraries

Community Libraries We Use

  • Multiplatform Settings: A Kotlin Multiplatform library for saving simple key-value data
  • SqlDelight: Multiplatform SQLite model facilitation library.
  • Koin: Service Locator/DI. Multiplatform in progress.

Libraries We Find Interesting

Sample Apps

How much of my code are we going to be able to share with KMP? 

Sam: One of the great things about KMP is that you have a lot flexibility in how much code is shared. As a rule we don’t recommend trying to share your UI code. Creating high quality UI is generally best accomplished using the tools and environment of each platform. Everything else is fair game. In practice you will find that the code you share will be the most critical business logic and the layers your platform developers are sick of doing twice.

How much weight does KMP add to our apps?  

Kevin: Minimal relative to other options, and proportional to how much you use. There is no re ection, and the standard library is small, so the Kotlin compiler includes only what’s actually being used. In general, minimal us- age of Kotlin in a native app will add a binary size in the 100’s of K’s. Major logic will likely get into the low megabytes.

We use Swift. How’s the interop with KMP?   

KevinIt currently presents to Swift/Objc as an Objc library. The usual Swift Objc interop issues will apply, but the generated header takes advantage of many of the naming you can insert for Swift. You can also now have ge- nerics (I highlight that because we did that, too). With ABI stability, direct Swift interop will be more of a priority. Possibly early next year, but there is no timeline yet from the team.

What type of ecosystem and tool are available? 

JustinThe existing, mature, and exciting ecosystems of native Android and iOS development are available. Not everything can be pulled into shared code, but the beauty of sharing business logic is that most of it can be shared. A mature and loved library that is already in Kotlin is very close to joining the KMP ecosystem. For example, once SqlDelight was set up to output Kotlin, it didn’t take long to make it compatible with shared code…and iOS developers love that they don’t need to deal with CoreData anymore but they can keep all the other stuff they love.

KevinMajor libraries have been appearing over the last year, from JetBrains and other groups. This will continue as more libraries from the mobile world are ported. The Kotlin community on Android is already one of the most active in technology, so there is an existing and active develop- er base. As for tools, Jetbrains makes tools as a core business. They have tools already for multiplatform, and will continue to improve them. One of the main reasons why Kotlin is successful now, and why Kotlin Multi- platform will be successful in the near future, is because JetBrains will be building the tools.”

How will KMP affect our ability to recruit and onboard new iOS devs? 

JustinEqual or better. Some iOS devs will be happy to spend time on getting the UI and platform-specific stu right. Some iOS devs want to become mobile devs and will be happy to start learning Kotlin. All iOS devs will be happy to know that it doesn’t force them out of the ecosystem and lose their identity.

SamKotlin Native will be much better received by new iOS developers than many other code sharing schemes. The ability to code UI natively while treating the common code as a normal framework is much less foreign than tools which require them to learn an all new framework.

Kevin: Developers tend to prefer the platform they use, but the idea that they are all violently opposed to change is overblown. Developers are skeptical to new tech, and often for good reason. Hopefully, including Kotlin will attract developers interested in new tech. In general, the decision to move to any “cross-platform” technology is not coming from the developers but from the management level, and it is often a mandate to pick something. It’ll be much easier to recruit iOS developers if they get to embrace Swift- UI and other new Apple tools and learn Kotlin code sharing as opposed to learning React Native or Flutter. 

How fast is the compilation time? 

KevinNot super fast, but the general dev process is to code on the JVM side first, which is more optimized, then rebuild the Xcode framework and call it from iOS. The next major version of Kotlin should be focused on various performance improvements (compilation being one of them).

Thoughts on handling concurrent operations in Kotlin Multiplatform? 

KevinKotlin Native’s concurrency model is different than the “classical” mod- els of the JVM and Swift/Objective C. It is something that new developers, coming from either Android or iOS backgrounds, will need to understand. It can be confusing at first, but the goal of these changes is less error- prone concurrency. There are some early libraries to assist with concurrency, but later this year we expect multithreaded coroutines to emerge for Native. At that point, most concurrency will be managed by libraries (like most concurrency is managed now). You’ll need to understand how it works, but the libraries will handle the heavy lifting for you.

How do I encourage optimal code sharing from the beginning? 

JustinFocus on well-established architecture principles of keeping the UI layer thin and modularizing code. Something new may be separating Android-specific libraries from common code but this is often a small amount because business logic is, by its nature, less platform-specific.

What’s the value-add over other technologies? 

JustinKotlin is THE language for Android. KMP doesn’t significantly change the way you develop native Android apps. KMP interop is native so there is very little run-time overhead and less boiler-plate code while developing. KMP outputs a standard iOS framework so iOS devs are still in familiar territory. By its nature, it keeps up with platform-specific technologies that motivate and excite strong native developers and those looking to join the space (retention and hiring). It doesn’t create its own ecosystem so it’s not a ‘B’ big decision, easy to iterate and revert, very little up-front cost compared to others.

SamIt’s optional, meaning you can do some, and no big decisions. Natively integrated: the interop is platform native, which is unlike pretty much all other options. Open source. Code sharing, so you can write and test your critical logic and architecture, but don’t build a dissatisfying UI. The language is popular and modern. That is important for libraries, hiring, and productivity.

Does KMP work with Android WearOS, Apple WatchKit, TVOS?

KevinKotlin 1.3.60 will add support for WatchKit and TvOS. Anything on the Android side already uses Kotlin, so there are no compatibility issues (Kotlin is the preferred language for Android).

How mature and stable is KMP?

KevinThe language and tooling have gone through significant change over the past couple years, but the build tools and features of the ecosystem have stabilized. The tooling and support libraries will continue to mature rap- idly during the remainder of 2019 and into 2020. As for stability, there is no “multiplatform” at runtime. It is a build time construct. Kotlin JVM is super stable. Kotlin Native’s runtime is stable, although you will occasion- ally run into things you don’t expect. Usually a result of cryptic messaging. That will also improve over the next year. Major apps are releasing Kotlin Native into production now.

What’s the best way to set up the dev experience for iOS devs?

KevinI think it’s important to establish that the plan is not to start writing everything in Kotlin. The shared code will support the native development experience of Swift and Xcode, especially as SwiftUI takes over UI development on iOS. Introduce Kotlin as a modern language that shares much of the syntax and concepts of Swift, and at an architectural level, it’s important to start thinking of our teams as “mobile developers” rather than specifically Android and iOS. Having an Xcode plugin for Kotlin means iOS developers can start reading and debugging Kotlin in the shared code without needing to dive in with new languages and tools. Once that knowledge is learned, the iOS team can start pushing code that the Android (and possibly web) teams will use. It’s important to minimize the idea that the iOS teams will just be getting code from the Android app, although that is often the initial reaction, as Kotlin is an ‘Android thing’.

How do you start migrated a codebase to KMP?

KevinPick one part that needs to happen on both platforms, ideally something that the iOS team isn’t excited about. SQLite is a good option, if you’re us- ing it. Nobody likes Coredata. SqlDelight is a far better option. From there, possibly networking, analytics, or any logic intensive operations that need solid testing. Because it’s “optional” sharing and natively integrated, it’s easy to weave shared code into existing code.

Can I hire for Kotlin Multiplatform? 

Justin: The community is growing quickly but this is new technology. At this point, there are very few experts, some devs with experience, and many more getting to know it. The greatest thing WRT hiring for KMP is that Kotlin is an easy language to hire for, and since it integrates well with new tech like Jetpack Compose and SwiftUI, even the people who built their careers on Android or iOS welcome it.

Kevin: In general, hiring for positions that are seen as forward-thinking and working with popular technology will be appealing to developers. KMP is new, so there isn’t a lot of experience out there. However, there are many developers experienced with Kotlin for Android, and a lot of developer community interest in KMP. Competing for talent will be easier if you embrace technologies that developers are excited about. KMP is certainly no exception. Today, you should expect some ramp-up time for people with experience writing Kotlin for Android. However, offering experienced Android developers the chance to focus on KMP will increase the pool of candidates interested.

Useful introduction to Kotlin Multiplatform resources 

Introduction to Kotlin Multiplatform

Introduction to Kotlin Multiplatform

Introduction to Kotlin Multiplatform

Using the Kotlin language to program logic that can be used on all platforms of your app, it creates common logic that the native UI of any app can call upon.

KMP is really about pragmatic programming to help meet the growing demand to develop mobile applications on multiple platforms – a clean, clear way to avoid having to write the code twice.

The philosophy that has driven Kotlin since its inception is about enabling developers to code for all platforms. Kotlin is a modern language that allows you to develop applications more cohesively, and dovetails with native platforms on Java, iOS, and the web, so you can build on what’s already been coded. You focus on sharing code that is data, business, or presentation logic, and leave platform-specific components to be implemented natively.

It’s important to note that multiplatform does not mean compiling all code for all platforms. In mobile app programming, for example, you determine which modules are platform-specific and which are common to Android and iOS. Those which you identify as common to both can be programmed using KMP, writing in Kotlin Native.

KMP is a low-risk way to avoid repeating logic to develop applications for iOS and Android more expeditiously and effectively. Ultimately, KMP leads to better code overall. And it’s one of the many reasons why Touchlab is now fully committed to Kotlin as the most viable way forward for development teams today.

As a programming language, Kotlin keeps growing in popularity throughout the world, and with the introduction of Kotlin Multiplatform (KMP), there’s been more and more chatter among the mobile developer community about the possibilities it can bring.

Users’ needs are the same, whether they’re using an Android or an iOS device. Development teams, however, remain siloed by discipline, whether they’re programming for web or Android or iOS.

So, as a software development team, you have some challenging questions. Can you provide consistent quality on all devices when you have different development teams with varying skillsets developing the same apps for different devices? And can you ultimately justify the amount of time, budget, and resources it takes to produce viable solutions? We believe KMP is the best possible way to answer to these questions.

KMP: ready right now

It’s madness, really. An app is written for the web. Then for Android. Oh, and then it needs to be written for iOS, too. (At the same time.) Same app, different code. The question is, “Why?”

Development teams are essentially tripling their coding and testing efforts to ensure multiplatform coverage. It’s costly. It’s time-consuming. And – this might be the craziest part – it’s uncertain what the shelf-life of the code will be. As we know, the future is unwritten. As always, the goal is to be able to implement products more efficiently, and with better testing across platforms. And up to now, every multiplatform coding solution that has come along really hasn’t worked that well.

The good news is that there is now a better way.

And a proven way.

We at Touchlab have been writing code in Kotlin and deploying it to Android and iOS platforms, with no hiccups. That’s why we’ve gone all-in with Kotlin Multiplatform.

KMP is a true multiplatform language 

Kotlin enables you to write once, and test once. No siloed development teams. The same code can be used across Android, iOS and Web apps with no changes, eliminating the need for a translation layer. In essence, you’re reducing the amount of business logic coded by frontend developers by consolidating it efficiently with native code, but not oversimplifying abstractions. What’s not to love about that?

No wonder there’s a groundswell of enthusiastic support in developer communities around the world. There are 1.5 million developers currently using Kotlin, with 96,000 GitHub repositories containing 100 million lines of code. And the numbers keep growing. It’s one of the top two languages that developers are hungry to learn.

Kotlin was developed as a completely new language eight years ago, built from the ground up as a pragmatic approach to coding – a way to develop cleanly, clearly, and quickly.

Simply put, Kotlin is more readable, reusable, interoperable, and safer, offering a first-rate developer experience.

KMP for your complete tech stack 

It’s a low-risk way to code because it dovetails seamlessly with the native platforms on Java, iOS, and the web. It’s a modern language that enables you to build on what you’ve already coded, without re-working or re-inventing what you already have. Plus, because the code you share is optional, you can start small and increment as desired.

Kotlin is really an extension of Java, so it’s not a big leap for Java developers to start using Kotlin at all. In other words, you don’t have to make a big, potentially expensive decision to get started.

Kotlin is really an extension of Java, so it’s not a big leap for Java developers to start using Kotlin at all. In other words, you don’t have to make a big, potentially expensive decision to get started.

 

In fact, on Android, Kotlin was built for direct JVM interoperability. On iOS, Kotlin is ready for prime time, and the first half of 2020 will see rapid mainstream adoption. And Google officially recommends Kotlin as a language of choice.

The big considerations for any development team are cost, time, resources, and risk. And the big problem with the siloed approach is that organizations are often tripling them.

At the same time, the wrong teams are working on the wrong projects. Back-end developers should focus on architecture as well as APIs – but not UI. Enabling your back-end developers to code and test the client and server features as a unified whole enables more rapid development with safer, higher quality and identical implementation.

Our experience with Kotlin so far? No siloed teams. More streamlined workflows. Real cross-platform functionality.

Useful introduction to Kotlin Multiplatform resources