热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

关于跨平台项目中的网络语言互操作性的问题

如何解决《关于跨平台项目中的网络语言互操作性的问题》经验,需要怎么解决?

我计划在iOS,Android和AngularJS网站上创建一个应用程序.

但是,由于不必在每个应用程序上重写业务代码,我希望尽可能多地重用代码.

为了能够在任何平台上执行项目的核心,我必须使用Web语言.

通过不同的文章,我计划一个通用的架构来分离项目的业务逻辑 - 核心 - 与将为每个系统重新实现的UI(UIKit for iOS,AngularJS和Polymer for webapp等)

该体系结构的目标是通过分解模块中的需求,DRYSOLID来尊重重要的软件工程原理,例如信息隐藏

每个功能都将在模块中分解.

Core: Business logic code - reusable on every platform - will be represented in form of a library.

View: The view class will be developed on each different platform to use the different UI elements proposed on each platform. E.g.: subclass of a ViewController in Objective-C/Swift for iOS or a simple class to manipulate HTML for the web-app. There is no logic in this class. It is only responsible to:

Handle user interactions to the business logic.

Display contents from the business logic

IView: Interface which abstracts the class which manipulates the view.

Presenter: Link between the Interactor and the View to drive the UI.

Interactor: The logic of the module, such as algorithms.

Data Store: Manage the persistence and the fetching of data by communicating with a database or API or web-service.

Model: Data represented in structures.

Here for iOS (almost the same for Android):

在此输入图像描述

The code of "core" will be executed through a virtual machine as this article shows us: http://www.skyscanner.net/blogs/developing-mobile-cross-platform-library-part-3-Javascript

Here for AngularJS:

https://docs.google.com/drawings/d/1NtdDfsr1yiuGOm_lfOY6Qab_kHb4I5b4sx7zeTAqwrE/pub?w=915&h=377


Now that you know everything about the architecture, here are my questions.

I don't have enough experiences and feedback on the web-langages to be able to make a smart choice. After few researches, I found that there are various options:

Dart:

Question 1: Are there mechanisms to allow interoperability between Objective-C/Swift and Java through VM? I know that both platforms have VM to execute Javascript code and Google provides dart2js to compile Dart to Javascript code. But it's not plain Javascript: See an example here. So I don't know if there is still a proper interoperability.

Javascript ES6: Event if it's not fully implemented in browsers yet, it's possible to start using ES6 with Traceur compiler.

Question 2: Is there interoperability of Javascript compiled by Traceur and the VM in iOS/Android?

Question 3: Is it "safe" to use ES6 through Traceur to develop a large-scale project and have production code?

谢谢你的阅读.


推荐阅读
author-avatar
洋紫儿__来丶了
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有