Hacker News new | ask | show | jobs
by friedman23 1253 days ago
Get ready for AR apps written in react native. The reason we have shitty inefficient software is because Apple, Google, and Microsoft haven't standardized on a performant cross platform framework other than the browser. Don't blame people writing software for not wanting to waste their lives translating the same logic to 3 different platforms and then maintaining 3x the code for the rest of their lives.
4 comments

> Don't blame people writing software for not wanting to waste their lives translating the same logic to 3 different platforms and then maintaining 3x the code for the rest of their lives.

If you decouple your UI from your business logic, then you only have to re-write the UI. If you must use a web-based UI, then consider using the platforms native browser control rather than bundling electron.

Ok, you decouple UI from business logic, have some state machine written in language X let's say that can compile ios, android, and wasm and allows for interop with the kotlin, swift, and js. Even then, the view code is often the most complex and bug prone part of the app. Business logic is easy by comparison (in my opinion).
Electron itself is not really that bad though. Sure there is not insignificant overhead but you can still make fairly resource efficient apps with it if you actually want to (and you can use Tauri if you want to go even further).

Also Slack, Discord etc. are not really using React Native (but rather normal web react if they are not using another framework). You don't really need Chromium for React Native which significantly reduces memory footpring (in fact a react native app can be close to indistinguishable from a "normal" native app in most ways). You can probably reduce React Native overhead to not much more than 100-200MB compared to purely native apps which seems reasonable.

I was just using the original poster's language when I was referring to "shitty inefficient software". I'll say it does bother me that we are standardizing on typescript with react being the default for cross platform development.

When I first started using react I loved it compared to what existed at the time, the ease of composing everything and the fact that it just used JS instead of a DSL for templating and it didn't mandate all these cargo-culted framework patterns.

But the warts are really starting to show up, writing React today with useEffect hooks everywhere reminds me of writing VHDL in college to simulate an automated train controller and now I'm reaching for things like XState to handle almost all state management (I have a feeling this complexity ends up appearing for all complex UI interactions though).

Also we are taking on a type system (which is good) but not seeing any of the performance benefits that could bring. Why is golang more than 100% faster than typescript? Both are statically typed languages but TS doesn't get any compiler optimizations because of the JS baggage.

That being said, I'll take JS with React + React Native if it means I can write apps once and ship to all three major platforms. It's exciting that ui frameworks like Tamagui allow for close to 90% code sharing.

So exactly how do you create a performant cross platform framework that takes advantage of all the platforms features? What happens when one of them create a new feature for their operating system?

When has there ever been a performant cross platform framework?

The abstraction doesn't have to be perfect. Most apps don't even take advantage of native platform functionality.
So now you’re going to have half assed cross platform products that you still have to have a bunch of #if ios preprocessing statements and won’t take advantage of the native features.

As a developer you will always have applications that are behind and have to wait on the third party.

This has been the case with every cross platform framework ever. See also JNI.

Nothing's perfect and often when there are platform inconsistencies like that someone abstracts the functionality away in a package so the application developer doesn't need to worry about it. I'd rather have 80% code sharing across platforms than no code sharing.
Have you ever done GUI development of a large app that was meant to be cross platform using Java?

What happens when it isn’t just an inconsistency. But a feature doesn’t exist at all? They have different number of parameters?

How do you handle the different permission models?

The apps are never as good. You still will have just as many shitty half assed apps as you have today with Electron.

Both Google and Facebook have both decided that cross platform apps weren’t good enough.

https://blog.xojo.com/2021/10/12/google-switches-to-native-o...

THIS
You're being downvoted because upvoting is the desired alternative to THIS spam...