跨平台逻辑引擎的最佳语言?

发布于 2024-12-10 12:11:50 字数 478 浏览 0 评论 0原文

我需要为应用程序编写一个逻辑引擎。本质上,这个东西将被输入 XML 文件中的一堆数据,然后它会处理这些数据并生成一个 XML 文件作为结果。

诀窍在于,该引擎需要在服务器上运行(可能是 Windows,也可能作为后台服务),并且需要在移动设备(主要是 iOS 和 Android)上运行。

逻辑并没有那么困难或复杂。在移动设备上,我们的想法是让研究人员能够快速而直接地访问引擎以获取非常小的数据集。服务器“版本”将执行完全相同的工作,但在巨大的数据集上执行。

GUI 将从该逻辑引擎中抽象出来。

我应该指出,“移动版本”应该能够离线工作 - 这意味着无论我选择在其中实现此逻辑引擎,它都需要在设备上本机运行。也就是说,它可以在移动设备的本地 Web 浏览器中以本地存储的文件形式运行。例如,我最初考虑使用 JavaScript - 但我认为没有办法让 JavaScript 在服务器端的多线程服务中运行。

有没有一种语言可以做到这一点?平台之间的重新编码最少?

I need to write a logic engine for an application. Essentially, this thing is going to be fed a bunch of data in an XML file, and it then crunches that data and produces an XML file as its result.

The trick is that this engine will need to run on a server (probably Windows, and probably as a background service) AND it will need to on mobile devices - iOS and Android, primarily.

The logic isn't that awfully difficult or complex. On the mobile devices, the idea is to give researchers quick-and-dirty access to the engine for very tiny data sets. The server "version" will do exactly the same work, but do it on huge data sets.

The GUI will be abstracted from this logic engine.

I should point out that the "mobile version" should be able to work offline - meaning that whatever I choose to implement this logic engine in, it needs to run natively on the devices. THAT said, it's perfectly fine for it to run in the mobile device's local Web browser in a locally-stored file. For example, I'd originally considered JavaScript for this - except I don't think there's a way to have JavaScript running in a multi-threaded service on the server side of things.

Is there a single language that offers to do this? With a minimum of re-coding between platforms?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

╭ゆ眷念 2024-12-17 12:11:50

您可以使用 Rhino 从 Java 服务器/servlet 内部执行 JavaScript。我不确定引擎的并行/线程程度如何。您还可以考虑托管 Google V8,它可能会具有更高的性能/更具可扩展性。

You can use Rhino to execute JavaScript from inside a Java server/servlet. I'm not sure how parallel/threaded the engine is. You can also look into hosting Google V8, which probably will be higher performance/more scalable.

最佳男配角 2024-12-17 12:11:50

我不认为你可以用一种语言完成所有这些(你可能可以,但它不会很漂亮)。

I don't think you can do all of this (you probably can, but it wouldn't be very pretty) in one language.

月牙弯弯 2024-12-17 12:11:50

Java(或其他 JVM 语言,如 Scala、Clojure 或 Groovy)是最接近的:它是允许编译后的代码在最大范围的平台上不加修改地运行的单一平台。

然而我不确定 iOS 上的 Java 支持有多好 - 这可能是一个棘手的问题。但这无论如何都会成为一个问题:苹果似乎并不特别热衷于鼓励除了自己的工具之外的任何东西。

也许最好的策略是用 Java 编写(这将覆盖您的服务器和 95% 的客户端平台),然后拥有一个小的客户端部分,您可以快速移植以适应 iOS 等特殊情况。

Java (or another JVM language like Scala, Clojure or Groovy) is the closest you can do: it's the single platform that allows compiled code to be run unchanged on the largest range of platforms.

However I'm not sure how good Java support is on iOS - this might be the tricky one. But this is going to be a problem in any case: Apple don't seem particularly keen on encouraging anything other than their own tools.

Perhaps the best strategy is to write in Java (which will cover your servers and 95% of your client platforms) and then have a small client side portion that you can quickly port for special cases like iOS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文