DEV Community

Simon Justesen
Simon Justesen

Posted on

Cross-platform Development

One codebase, multiple platforms. We've heard this promise ever since Java was released. I take the continued popularity of Java as a sign that it somewhat delivered on the promise.

Many years later, we're still at a point where many frameworks like Flutter, Xamarin, Cordova and React Native promises us to deliver that magic silver bullet: Cross-platform mobile development. Based on my own experiences I'd say they're failing.

Now, I'm certainly not trying to disregard the hard work done by the teams of said frameworks. They're all brilliant, and I love that the tools exist. But you should base your work off them for the right reasons.

If you think you can just write your code, and then start cashing in at the bank, because you can publish your apps on a lot of platforms in one go with little to no work, you're in for a big surprise.

Let me outline a few of the observations that I've done:

  • Cross-platform tools are almost never on par with the tools offered by the native platform. So you're going to have to accept some shortcomings, like the very latest features not being available to you.

  • You're not going to avoid writing native code (or wrapper classes), in say, Kotlin/Java/Swift/Objective-C. So you should be proficient in one of these languages.

  • The further away from the native platform you step, the more likely it is that your application becomes unstable, because there are more places your code or your toolchain can and will break.

  • Outdated or incomplete third-party libraries. The former will probably block or delay your ability to update your app. The latter will make you have to reimplement missing features that's already in the native libraries (we don't want to reinvent the wheel, do we?).

  • Your toolchain will break at some point. I've spent countless hours trying to determine whether a build crashed due to a bug in the cross-platform framework or the tools supplied by the platform I'm compiling for. However, this is really a structural problem that I believe happens whenever a toolchain becomes too complex, like we've seen in recent years with other projects like nodejs.

All in all, I think that the problems I've encountered along the way kinda defeats the purpose of using a mobile cross-platform development tool. On one of my pet projects I went back to having separate codebases. It does mean prolonged development times, which is quite a bummer, but on the contrary I'm picking up a few new languages along the way, and not having a struggle with toolchain related problems. Not bad at all :)

This is my experience. What's yours? :)

Top comments (0)