The myth of cross platform software

If you're a programmer you've probably run into phrases like these many times:

build beautiful, natively compiled applications for mobile, web, and desktop
write once run anywhere
product name is a cross platform [..]

Sounds great but sadly in practice it turns out to be a mixed bag ranging anywhere from actually cross platform to straightup useless
So how does cross platform software even work, and what causes it to succeed or fail? Let's find out!

What's a platform anyway

How I see it a platform is basically the level of abstraction below that of your application. So your platform might be an operating system, in this case your application will be written by calling the syscalls provided by the operating system (or libraries that call those syscalls for you). Your platform might also be a web browser, in this case your application will be implemented using standard web technologies. You could also target raw hardware, in this case your platform is the instruction set and the hardware-level io.

The problem

We can already see some limitations start to arise. You can't implement a cross platform game engine for windows, web and arduino because arduino doesn't have a display to display your game. A pure cross platform application can only be implemented using the subset of features provided by every platform you want to support.
Obviously you could go the route of only supporting certain features on certain platforms but this brings back pretty much all the complications you would've had if you just wrote your application from scratch. The fake cross platform library might even cost you extra time because you believe it solves all your problems and months later you realize it doesn't support a certain feature that you need, causing you to strip the library out of your project or abandoning the project entirely.
This problem is pretty much inherent to cross platform software. The best thing you can do is research if a library supports the functionality you need before investing time into integrating it into your project. With that being said, low-level cross platform libaries are still very much worth your time as long as you're not doing anything too esoteric.
Moving up to higher levels however we'll start running into artifical problems...

Write once, run anywhere

This is a the slogan of Java meant to brainwash you into thingking you need Java to write cross platform code. Guess what, you don't! All Java really gives you in terms of cross platform software is a nice library for networking, file io, etc. But you don't need java for any of this. And on top of that you get the performance hit of the jvm which translates its bytecode to native machine instructions at runtime. It's important to note that Java would've been just as cross-platform if it was a compiled language that produced native machine code for every platform, Instead they decided to go the route of writing a jvm implementation for every platform.
What makes this so sad is that introducing the abstraction of the jvm has actually made the code less cross platform. Once you're in vm land you're stuck there forever, no sane person would ever create a program in a language other than java and depend on some java module.
Meanwhile if Java had been a natively compiled library everyone could include it in their project, even higher level languages.

The bloating continues

If the jvm wasn't bad enough, some people over at facebook thought it was a good idea to write cross platform applications in javascript. What's so bad about that?



Absolutely nothing, web technologies are great!


But of course they found a reason mess it up either way. From what I've heard the main issue with react native is the slow startup time caused by it needing to load a large javascript bundle. One has to wonder why the javascript bundle is so large as for it to take a significant time to parse, but that's all I'll say about that fow now.
From my personal experience using react native I can say the main problem I encountered was that the actual renderer was dog slow. Seriously. Just loading in a list of ~50 forum posts already had the app lagging like crazy. At that point I have to ask: Why even bother with a custom renderer? Just use the web!
technologies like these shouldn't exist and actively harm the "developer community" as a whole, tricking companies into using them and wasting hundreds of hours on a product that will never reach stability.
Think of it like this:

And I don't just mean tiny components here and there. I want to see them write entire applications using their own frameworks before I start taking them seriously. Just look at this post from 2016 where facebook is proudly announcing a 1 second startup time for their event dashboard after switching to react native.
Even a web app can reach way faster levels of performance than that, come on!

The solution

Unless you know what you're doing, don't bother with cross platform. It's a time sink and you usually won't end up caring anyway. What you should actually be doing is just targeting the platform that most of your users will be on. If others really want to use your program they'll switch platform to do so.
Luckily the web makes it easier than ever to reach a wide audience, and it's the platform I'd recommend you to target for a solid 80% (and growing!) of projects.