4 ms·
I understand that attempting to write once, run everywhere doesn't make for a good user experience. For the best experience, it will probably always be necessar
by mwcampbell 13y ago
I understand that attempting to write once, run everywhere doesn't make for a good user experience. For the best experience, it will probably always be necessary to develop a different front-end for each platform.
However, what does one do for logic that belongs on the user's 'device (i.e. client-side) and will be the same on all platforms? Especially considering that one of the targeted platforms may well be the Web.
One solution is to use the Xamarin suite for native targets, and something like Script# or JSIL for the Web. Of course, Script# and JSIL can only support a subset of .NET functionality, e.g. no shared-memory threads and therefore no blocking APIs (unless one of these compilers can transform code into continuation-passing style). Another possible solution is Haxe, which can compile to JS, Java, and C++ among others. The trouble with both of these solution is that when working on the Web version of the app, one has to know both the Web stack and the other language.
It seems to me that the best solution is to write all platform-independent client code in JavaScript, minimizing the use of browser APIs for that code (e.g. only XHR and setTimeout). Then, for the native mobile versions of the app, integrate a JS engine (note: not a web view), find or write stand-alone implementations of XHR and whatever other APIs one needs, then write the front-end in the native language for that platform.
Any thoughts on this? For native mobile apps, are we stuck rewriting everything in ObjC and Java, and maybe also writing a JS version for the web?
- wrl 13y agoI'm of the mind that platform-independent code should be written in either C++ or C, then compiled into the platform application as a static library. This is how it's often done with desktop applications.
- chrisdevereux 13y agoIn case you missed it, this made it onto the front page a while ago: http://www.steamclock.com/blog/2013/05/apple-objective-c-javascript-bridge/ http://www.steamclock.com/blog/2013/05/apple-objective-c-jav... So there are some signs that you might (eventually) get what you want. It will be interesting to see if anything related gets announced next week at WWDC.