Is Kotlin MPP communicated wrong?


I’ve got a real problem when I try to explain what Kotlin MPP is:

  • When talking about Android and iOS people immediately realise what that means.
  • When talking about Kotlin/JS they understand what it means after a while.

When talking about a multi-platform project that goes over the client - server boundary, most people get lost.

Let me show it through an example:

I told an android developer of my company, that she does not have to worry about the communication. No Volley, no Retrofit, forget it all.

Just use the objects defined in commonMain of the common data model project. Everything will work because the communication can be automatically handled once you have the data model. Don’t worry about URL’s, generated APIs, etc. You don’t need anything like that.

She looked at me like I’m an alien. What do you mean?

As a business level developer you don’t need URLs and you shouldn’t to code any APIs. You say MyObject().create() or That’s it.

Oh, and when your college develops the browser frontend, he uses the exact same syntax. Actually, we can put a few classes into common code and use them both for the mobile and browser projects.

In Kotlin, not writing (and not generating) communication code at all is reality.

Sharing components between mobile and browser is reality.

Our projects use the exact same communication and validation everywhere (mobile, server, browser).

I feel that Kotlin MPP is communicated wrong.

Mobile clients and JS are important on their own. But as I see they are just part of a bigger picture.

So far I’ve never seen the integration communicated properly. You tend to think an application as separated parts: mobile, server, browser.

Why? These are parts of one application. They should not be more different than necessary.

When I talk about this with developers personally, I can explain how this works. And the feedback is usually very positive. They realise the power of having one language.
They realise that having one common code used by all software components is good.

When I try to write this down, I’m stuck. I’ve literally spend days with this and haven’t been able to do it well. (As this example shows. :smiley: )

I think you’re conflating two things - higher level system design and application code layering.

They are different applications that are part of the same system. They just happen to share some common code for business logic between them.

I’d argue that most of the time the biggest distinction you have is between the browser/desktop app vs the mobile apps. The main difference is in the UI/UX which is different due to the screen real estate available. The user will navigate differently though your desktop/web/browser app vs your mobile/ios/android app.
They could share common business/networking/storage logic though. That’s where Kotlin MPP is handy.

Seems like she is a junior dev who doesn’t understand that any client side application, ios, android, browser web, etc. is implicitly or explicitly split into multiple layers such as business logic layer, UI layer, networking/services layer, and storage layer. What you’re trying to explain makes a lot of sense when you get the concept, not building against specific urls makes total sense because instead you just call some commonly shared abstraction in your networking/service layer instead.

I think you’d reach to more people if you approach your explanation/evangelizing through this lens of architectural layers in app codebases.