Hacker News new | ask | show | jobs
by bsimpson 4156 days ago
The architecture (shared business logic with platform-specific UI) sounds a lot like React Native. The difference is that in RN, your UI is primarily specified in JSX on all platforms. This means you can even reuse a lot of your non-platform-specific UI.

I expect that in a year or two, there will be a React Native UI library that implements Material Design on Android and the Web, perhaps even with iOS bindings for things that are similar across platforms. It will always be a best practice to adopt the conventions of the platform you're on, but it does nobody any good to implement the same UI three times. Reuse your <Text>, your <Image/>, your <ProductListing/>, etc. and save the platform-specific UI for things that change across platforms (like navigation paradigms).

2 comments

IIRC, React Native still runs a JavaScript thread to execute the logic. JUniversal and similar code translators will convert to Obj-C (iOS) or C# (Windows Phone) to run at native speed / memory / CPU consumption.
> The architecture (shared business logic with platform-specific UI) sounds a lot like React Native.

That is a very common approach.

So far I have done that for an hobby application using C++ for the business logic, as it is the language common to all SDKs.

So on my case was Java/C++ on Android and C++/CX on Windows Phone.

Where it fails down is the NDK pain in Android, where the best aproach to avoid JNI hell is to use the same approach as distributed computing.

Instead of calling lots of Android API methods, just invoke one that does the bulk of the work on the Java side and back.

Alternatively a binding generator like SWIG or Djini.

I almost though a few times to go back to Qt, but there one is forced to re-write the UI multiple times anyway as it provides very little support for native integration and everyone is forced to mimic native behaviors in QML and JNI invocations.