12 ms·
Netflix Android and iOS Studio Apps now powered by Kotlin Multiplatform
- wdb 6y agoI am doing something similar for my apps but instead of using Kotlin I am writing it in either Swift or C#
- untog 6y agoHow are you using Swift on Android?
- deleted 6y ago[deleted]
- FlyingSnake 6y agoThere are several ways to use Swift on Android. It's basically Swift <-> C interface <-JNI-> Java. The following links could be a good starting point for Swift on Android. [^1] https://github.com/apple/swift/blob/main/docs/Android.md https://github.com/apple/swift/blob/main/docs/Android.md [^2] https://github.com/readdle/swift-android-toolchain https://github.com/readdle/swift-android-toolchain
- anupamchugh 6y agoWould you really use a JNI bridge and end up with a possibly heavier codebase? Swift for Android isn't officially supported by Android yet. I'd rather use Kotlin Multiplatform instead.
- untog 6y agoSounds messy. You’d have to manually define the JNI calls on both sides if I’m reading correctly? Good to know it’s possible though. Just maybe with more tooling...
- liuliu 6y agoJNI is so expensive when cross the language barrier, you have to be conscious to constantly minimize your API exposure. This may be helpful in long-term, but not helpful for onboarding purposes. On the other hand, if you can lower Kotlin to native code, it may be more natural to interact with (of course, there are still these nonsense of Java's default UTF-16 string <-> Swift's native UTF-8 string conversion). Interoperability between high level languages are just hard. I am skeptical of either way, but I can see how it is more appealing to go from Kotlin to Swift direction. On the other hand, data modeling and high-level data transformation doesn't require all language features. It is possible to do such with a limited DSL that supports product / sum types, some filter / map / flatmap / zip, and boom, you now have your view models for UI rendering. As long as we've made up our mind on string UTF-16 / 8 or have some performant library to do lazy transformation on these. We can go a long way on standardize business logic cross iOS / Android platform.
- pjmlp 6y agoJava is replacing JNI with Panama efforts, but don't expect that to come to Android. In fact, in 10 years Google has never made available their internal tools that simplify JNI integration, leaving the community on their own to create our tools.
- wdb 6y agoI am using the Elements compiler (supports Swift, Go, Visual Basic, C#, Java and Object Pascal) that allows sharing business logic and write UI code separately in the appropriate platform's tool.
- dep_b 6y agoC# is really great I've used it for cross-platform desktop applications but there are a lot of mobile developers that don't know it. .net has the nicest libraries in my opinion. If I look at the fights I need to have with Gradle every time.....so many things have already been solved by Microsoft decades ago (WPF with MVVM was really a joy to work with) only to be reinvented later in a bad way by Google.
- avtar 6y agoAre any of the C# ones opensource? Are you using Xamarin Forms for the UI or native UI solutions?
- anupamchugh 6y agoThis is a big move! I haven't seen many people use Kotlin Multiplatform for mobile app dev. Personally, never trusted Google due to their inability to stick with one technology. They have Kotlin Multiplatform and Flutter both for cross platform development. But Netflix's strategy might just encourage others to adopt too.
- nicoburns 6y agoKotlin isn't really a Google project (although they adopted it). It's made by Jetbrains.
- The_rationalist 6y agoKotlin has many full time paid compiler developers by Google
- lemming 6y agoDo you have a source for this? I develop a plug-in for JetBrains IDEs professionally, I talk a lot to people there and I’ve never heard this.
- The_rationalist 6y agoJust look at the paid members of the kotlin foundation: (Ctrl find Google) https://kotlinlang.org/foundation/kotlin-foundation.html#kotlin-foundation https://kotlinlang.org/foundation/kotlin-foundation.html#kot... https://github.com/jsjeon https://github.com/jsjeon is probably the most prolific one as I often see him in the commit history. BTW which plugin are you working on?
- lemming 6y agoBut if you look at the contributor history for the repo, he's at #54, just after JetBrains' actual CEO. I don't think you could make the claim that Google contribute significantly to the language itself based off that. I develop https://cursive-ide.com https://cursive-ide.com.
- FlyingSnake 6y agoThe blog post reads like a high level overview and skips the real engineering behind the scenes. I wonder how they'll integrate native functionalities like geolocation/audio-video/maps etc which are highly platform specefic.
- georgyo 6y agoThey also said that less than 50% of the code was shared, which means there is still a lot of platform specific code. > Almost 50% of the production code in our Android and iOS apps is decoupled from the underlying platform.
- anupamchugh 6y agoWith Apple, you can never expect them to expose platform specific APIs to other languages and frameworks outside their ecosystem.
- gregkerzhner 6y agoWe are doing something similar on my project except using the J2OBJC compiler. The compiler is a cumbersome, unwieldy tool, but the cross platform approach overall is great. We write the core logic of our app using the cross platform approach. Platform specific APIs like geolocation or maps get handled natively, but pass their data off as inputs to the cross platform implementation. So for example, you wouldn't render a map natively, but you could write a handler for an updated location from a map, or query the network based on the current map area and return some results. An added bonus of this approach is that it forces you to have a clear separation between your user interface code, and your business logic. A lot of mobile (and front end) apps out there have no architecture, putting API calls, state management and UI right next to each other in the same modules. Our approach forces you to keep UI code just focused on UI, while keeping all logic somewhere else, where it can isolated and as a benefit much more easily unit tested. You would be surprised just how large of a share of your codebase can be moved into platform agnostic code if you have a solid architecture. Our UIs are "dumb" and render themselves from view models which have exactly the data needed to render the view. All the logic and state management to construct these view models can be written in the cross platform repo and shared across the Android and iOS apps. For example, to render a list, you will need to use the native UITableView or RecyclerView separately, but all the code that manages how many rows are in the list, the data each row needs, as well as updating the data when the list is reordered can be shared across platforms.
- helsinkiandrew 6y ago> Netflix has been developing a mobile app called Prodicle to innovate in the physical production of TV shows and movies I assume this has nothing todo with video as its on a phone, but does anyone in the TV business know what this app actually does or could do - time management/planning/todo/contacts/legal/safety guidelines repository etc?
- helsinkiandrew 6y agoOh, all of those things: https://help.prodicle.com/hc/en-us/articles/115001787672-Welcome-to-Prodicle https://help.prodicle.com/hc/en-us/articles/115001787672-Wel...
- K0nserv 6y agoI am very unconvinced by cross platform UI solutions, as such I like the idea of Kotlin Multiplatform. Sharing non UI code has always been possible via C/C++, but it suffers from several issues not the least of which is having to write C/C++. The executions I've seen of this for example often bundle curl + boringSSL for an HTTP/HTTPS stack instead of linking against the system provided networking libraries. Aside from Kotlin I also think Rust with C FFI or WASM are good potential avenues to explore here. In the WASM case generic business logic can be written in Rust and compiled to WASM, platform capabilities such as networking/GPS etc can be exposed to the WASM VM via functions provided by the host. Further, with WASM it would also be possible to run the same code across web, native clients, and the server.
- dep_b 6y agoThe main reason to use Kotlin is that it looks like Swift and most Android engineers already use it. As an Objective-C and Swift developer I can read C and C++ and dibble a bit in it but to write serious code from scratch: forget it. Kotlin itself feels quite natural, though the Java and Android libraries especially can be a bit weird at times.
- K0nserv 6y agoYeah that’s definitely a strength of Kotlin multi platform. My general point is that doing cross platform UI specifically leads to poor experiences, whereas sharing non UI code doesn’t have that issue
- The_rationalist 6y agoWhy would ionic leads to poor experiences?
- K0nserv 6y agoCross platform solutions all share several issues that result in poor experiences: Reimplementing platform UI Poor reimplementaions of platform UI, such as navigation, that almost always looks subtley wrong or doesn't "feel" right in terms of interactivity. This also often lead to shipping a single platform's UI convention on every platform, for example Material on iOS or iOS patterns and conventions on Android. Poor UX An app's UI is more than just how it looks, just as important is how it feels, and if it fits in and feels at home as an app on the platform. Often cross platform solutions generate apps that have slightly "off" UX, such as sluggish interactivity(RN has this this issue), missing gestures(such as backswipe). In general many small cuts that deterioriate the user experience Focus only on the visual The visual representation of an app is only one part of the UI as mentioned above, an obvious other example is accessibility which is often lacking with cross platform tech, especially on iOS. I wrote a whole blog post about how Flutter Web fails[0] in this regard yesterday. Binary size By necessity cross platform solutions reinvent a lot of what the platform already provides which leads to larger binaries(performance is a feature). Performance Ionic for example, runs in a non-JIT(on iOS) enabled webview so can never match the performance of native. React Native runs a JS enging(again no JIT on iOS) which demands more from the device and uses more battery than native in my experience(performance is a feature). In general, cross platform UI works by targetting a lowest common denominator of the platforms which naturally results in a worse experience. 0: https://hugotunius.se/2020/10/31/flutter-web-a-fractal-of-bad-design.html https://hugotunius.se/2020/10/31/flutter-web-a-fractal-of-ba...
- filleokus 6y agoKotlin Multiplatform looks really cool and limiting code sharing to non-UI code makes much more sense to me. However, I wonder if/when/to what extent the abstractions become leaky. For me it makes perfect sense to e.g create an internal API client using this. You use platform specific frameworks for making the actual HTTP requests[1], but can write all higher level business logic in Kotlin and expose that. Adding a new REST route or change data validation would be done only once and be in sync on all platforms. But I'm guessing that you have to pretty knowledgeable about the underlying platforms to know how (and if it's even possible) to create a good abstraction above the platform code. For something like audio/video playback or BLE, I'm guessing that there might be enough differences between Android and iOS that an abstraction that fit both is really unwieldy. And even if you create something resonable today, one of the platforms might introduce new features which destroys your abstraction. [1]: I noticed that they even have some kind of built-in HTTP client abstraction: https://kotlinlang.org/docs/mobile/use-ktor-for-networking.html#select-an-engine https://kotlinlang.org/docs/mobile/use-ktor-for-networking.h...
- dakna 6y ago> noticed that they even have some kind of built-in HTTP client abstraction It goes one step further, you can have platform-neutral code to parse the API returns into Kotlin models. https://blog.jetbrains.com/kotlin/2020/10/kotlinx-serialization-1-0-released/ https://blog.jetbrains.com/kotlin/2020/10/kotlinx-serializat... A lot of business logic is shared in the domain layer on each platform client (and possibly on the server), and I think re-use of that is/will be Kotlin's main selling point. Add SQLDelight for shared data access code on clients, and you can cover a lot of ground with one codebase.
- tootie 6y agoWhat exactly is the value of this though? Isn't most non-UI code going to be buried in your server APIs no matter what? Most apps end up being 90% UI code.
- ffggvv 6y agothat’s not true at all. especially for apps like netflix or youtube, but even average apps source: have worked on apps you likely use every day
- peter_retief 6y agoKotlin is a really nice language to use. I learnt it recently but have not done any billable work with it yet. Hopefully soon..
- RyanShook 6y agoThe app mentioned is developed by Netflix but held in a company called Prodicle LLC and makes no mention of Netflix in description. Just kind of interesting.
- nicolas_ 6y agoNetflix is mentioned everywhere on the website though https://help.prodicle.com/hc/en-us/articles/115001787672-Welcome-to-Prodicle https://help.prodicle.com/hc/en-us/articles/115001787672-Wel...
- bhahn 6y agoCool to see a big company using Kotlin multi platform. It sounds like this tool is used internally. Given that, was it not possible to issue tablets of a single platform to users instead? Or are users using their personal devices?
- TulliusCicero 6y agoIt sounds like it's a production tool used by people creating shows; the different studios making 'Netflix shows' are not, to my understanding, actually part of Netflix. They're just partners, so they probably have their own set of hardware already (or yes, are just using personal devices).
- xrd 6y agoCan anyone comment on whether Kotlin Multiplatform could be used instead of Flutter if the goal is write once for both iOS and Android? I am excited about porting my Android apps to Kotlin from Java and then having a path to iOS, as opposed to rewriting the entire thing in Flutter. Is that possible?
- deleted 6y ago[deleted]
- DataCrayon 6y agoFrom another comment below it seems Kotlin Multilpatform is for multi-platform libraries, not UI!
- sudhirj 6y agoFlutter is purely a UI toolkit. It takes a rectangle from the OS and draws everything inside, like a game would. It just happens to copy Android/Material design and iOS design. The point is to to provide a reactive UI system. Focus is converting objects to fast 2D drawing. Kotlin multi platform as described here has no UI system, it’s a way of compiling Kotlin to binaries that are easily linked to both Android and iOS apps, with some bridging back and forth conversions into the native systems in each case. You’ll still need two separate code bases to call the common binary and handle UI.
- mark_l_watson 6y agoI took a fairly deep dive looking at Flutter last spring and I was impressed. My work involves semantic web and deep learning, I am not a UI developer professionally, but I enjoy small UI projects. Try spending one or two evenings with Flutter writing a simple app and build it for two or three platforms to see what the few issues are.
- someUserTonight 6y agoDefinitely possible. You can refactor your Android app to be split up into essentially two "modules", one with your business logic and then the UI/native platform specific libraries. Once you have that setup you can then add a different platform "web/iOS". The base module would have setup certain contracts that new "platforms" would have to implement.
- sandoze 6y agoI’m curious if the majority of code being shared is limited to models and API calls and if so, why not use an OpenAPI spec and generate code for all of your platforms (not just mobile)?
- jtsiskin 6y agoThey share a rule evaluation engine and offline SQL store.
- The_rationalist 6y agoWill jetpack compose be able to make cross-platform the UI code too?
- skinnyasianboi 6y agoAs far as I know not yet. But the way it is build it could be adopted in the future.
- brudgers 6y agoDoes anyone know how far down Kotlin Multiplatform is likely to scale, because most engineering org charts are not the shape and quality of Netflix's engineering org chart? At what size and level of expertise/experience does it make sense to consider it? What are the prerequisite knowledge/skills/abilities that a two pizza team needs to keep the learning curve practical?
- chrisweekly 6y ago+1 I love this question; it doesn't get asked enough. (Also, I have interest in hearing others' answers for Kotlin Multiplatform in particular.)
- rapsey 6y agoMainly depends on the depth of the apps. If they are just UI and API calls then no. If there is a lot of processing snd state management going on then the more there is the quicker it makes sense
- maxsilver 6y ago> What are the prerequisite knowledge/skills/abilities that a two pizza team needs to keep the learning curve practical? Just my personal experience, but if you have a good Android/Java "two-pizza team", you probably already have the makings of a good Kotlin team, given the appropriate time for folks to pick it up.
- billjings 6y agoI think it's more a matter of expertise/experience than size. The different platform teams have to have gelled enough to agree on the core architectural abstractions, which is a level of maturity that goes a step beyond necessity. So the platform teams need to have shared prior knowledge of how to build with the same architectural patterns, and they need to be sold on the possibility and merits of using those same patterns and coordinating on their plans of implementation.
- hitekker 6y agoI've always felt that JS could have been the language for shared mobile & server business logic. Write a throwaway script in a light, fast interpreted language, and then share it with your compiled, native platform-specific UI code. If you need to update that one script, the app can phone home and get the latest. No need to update the entire app. That's how I wrote multiplatform code 7 years ago, using hidden webviews in the background. Unfortunately, Android or iOS to this day have not supported JS (or really Node/V8) as a first-class citizen. The best approach is still just to use webview, which has a performance cost, amongst other complexities. Time will tell if Kotlin Multiplatform is light enough and has the minimum number dependencies to warrant its inclusion in mainstream, high-traffic applications.
- snappytrap 6y agoSquare has been using it for awhile: https://developer.squareup.com/blog/developing-on-ios-and-android/ https://developer.squareup.com/blog/developing-on-ios-and-an...
- m3kw9 6y agoMy experience is that the development speed suffers a bit when you need to handle more than one code base and it also more difficult to test because the UI depends on the business logic but now they are separate and used by 2 different UI code bases
- agloeregrets 6y agoBingo. Very few companies have had any form of success in multi platform development tools. Netflix probably will simply because their app logic is generally so incredibly simple compared to others. (View list, select video, play video) sure there’s some complex backend logic and streaming tech but overall the app is simple. $5 says the iOS app isn’t THAT common however. To be honest, I’m kinda surprised they don’t just go Cordova, one platform for all.
- m3kw9 6y agoYeah, often is easier to just have a good requirements doc and have iOS and Android team + qa make sure it is adhering.
- myko 6y ago> Cordova It's usually pretty easy to tell Cordova apps from native apps. The quality is wildly different and they tend to "feel" wrong, even to users who aren't super technical. I would never recommend that route unless you're on a shoestring (<$10k) budget. Even then I'd recommend Flutter first.
- The_rationalist 6y agoThis is a myth, repeating it amplify it but doesn't make it more true. Moreover Cordova is outdated and you should compare the current state of the art which is Ionic/Capacitor. Contrary to flutter it doesn't feel wrong and actually doesn't have big performance issues contrary to the former. The fastest 2D renderer (skia) is made for chromium and second class citizen such as flutter are doomed to be inferior, plus their human resources are lacking. Example of an not so old, non production-ready issue: https://github.com/flutter/flutter/issues/31138 https://github.com/flutter/flutter/issues/31138
- aforty 6y agoI fucking hate deep linking on iOS. That opens the medium app and nothing useful in it.
- julius_set 6y agoThis is for an internal app, makes sense that it worked out well for them because the internal app is mostly a greenfield project. Some resume padding and performance review check offs for those associated with the project, however this Kotlin Multiplatform is NOT stable enough for most large scale applications. For starters good luck turning on / off features, handling UI state, and tying in the business logic to that state. And good luck mangling dependencies and build times with a new added Kotlin dependency :-)
- adsharma 6y ago> Even after a considerable amount of work, it still suffers from memory leaks in some concurrent execution scenarios, and we don’t have a clear solution to address them. https://blog.jetbrains.com/kotlin/2020/07/kotlin-native-memory-management-roadmap/ https://blog.jetbrains.com/kotlin/2020/07/kotlin-native-memo... Why is this not a problem for Netflix?