哪种语言可以成为强大的 JVM 替代语言:Scala、Clojure、Fan、JavaFX Script 或其他语言?

发布于 2024-08-06 21:18:17 字数 485 浏览 7 评论 0原文

我目前正在决定使用替代 JVM 语言来移植用 Java 6 编写的现有 Swing 桌面应用程序。鉴于 JavaFX 专门针对此类应用程序,看来我的最佳选择是 JavaFX Script

但是,其他类型的应用程序和库呢?一般来说,JavaFX Script 是否是第二种 JVM 语言的最佳选择?

目前,Scala 似乎是最受关注的 Java 语言替代方案。本月(2009 年 10 月),它位于 中的第 34 位TIOBE 指数,而 JavaFX Script 位于第 44 位,Clojure、Fan 和 Groovy 位于 50 以下。

那么,您的印象如何?假设您可以自由选择给定项目在 JVM 中运行的语言,您会投入时间学习和使用哪种语言(以及原因)?

I am currently deciding on an alternative JVM language to port an existing Swing desktop application written in Java 6. Given that JavaFX specifically targets this kind of application, it would seem that my best option is JavaFX Script.

However, what about other kinds of applications and libraries? Would JavaFX Script be the best choice in general for a second JVM language?

Currently, it seems that Scala is the most talked about alternative to the Java language. This month (October 2009), it is at position 34 in the TIOBE index, while JavaFX Script is at position 44, and Clojure, Fan, and Groovy are at positions below 50.

So, what are your impressions? Which language would you invest your time in learning and using (and why), assuming you can freely choose the language for a given project to run in the JVM?

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

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

发布评论

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

评论(3

苦行僧 2024-08-13 21:18:17

我的主要问题是:为什么要移植现有的应用程序?这个问题的答案可能会让您知道您想去哪里。

对主要选择的一些快速看法:

  • 在我看来,Scala 是比 Java 更好的 Java。如果您想要一种既继承了 Java 优点又添加了许多新创新和功能的语言,那么它很可能适合您。
  • Clojure 是一种设计精良的语言,特别是如果您相信高度复杂的并发应用程序的未来。它的生产力也非常高——我可以用 Clojure 每小时创造比任何其他语言更多的价值。然而,除非你已经了解 Lisp,否则一开始你会觉得很陌生。如果您愿意生活在最前沿以获得这些好处,Clojure 可能很适合您。
  • JavaFX 脚本 - 具有一些非常好的 GUI 设计功能,并且显然支持 Sun/Oracle。另一方面,我不认为它在这个领域之外有巨大的吸引力。我建议您尝试一下,看看它是否满足您的需求。
  • Java - 应该仍然在您的列表中!如果您移植的原因是代码变得难以维护,那么在保留 Java 的同时进行重点重构阶段也许可以为您带来您想要的好处。用 Java 编写完美的 GUI 应用程序是可能的。
  • Groovy - JVM 上非常好的脚本语言。如果您想在现有的 Java/JVM 应用程序中嵌入脚本功能,则特别好。但不确定我是否会选择它来(重新)编写完整的应用程序。
  • JRuby / Jython - 我自己没有见过这些,但听说过一些好东西。如果您在团队中拥有 Ruby / Python 技能,但又希望获得 JVM 平台的优势,那么这可能是最合适的。

My main question would be: why are you porting an existing application? The answer to this question may give you some idea of where you want to go.

Some quick perspectives on the main choices:

  • Scala is in my view, a better Java than Java. If you want a language that takes the best bits of Java buts adds a lot of new innovations and features, then it may well be for you.
  • Clojure is an amazingly well designed language, particularly if you believe in a future of highly complex, concurrent applications. It's also extremely productive - I can probably create more value/hour in Clojure than any other language. However, unless you already know Lisp it will seem very unfamiliar at first. If you are willing to live on the cutting edge to get these benefits, Clojure may well be for you.
  • JavaFX script - has some very nice features for GUI design, and clearly has support of Sun/Oracle. On the other hand, I don't see it having massive traction outside this domain. I'd suggest giving it a trail run to see if it meets you needs.
  • Java - should still be on your list! If the reason you are porting is because the code has become difficult to maintain, then maybe a focused phase of re-factoring while staying on Java can get you the benefits you want. It's possible to write perfectly good GUI applications in Java.
  • Groovy - really nice scripting language on the JVM. Particularly good if you want to embed scripting features within an existing Java/JVM application. Not sure I'd choose it for (re)writing a complete application however.
  • JRuby / Jython - haven't seen these much myself but heard good things. Probably most suitable if you have Ruby / Python skills in the team but also want the benefits of the JVM platform.
葬花如无物 2024-08-13 21:18:17

最好的替代语言,以及总体上最好的语言,IMO,是最能让您以最佳模型编写程序的语言。

因此,如果您正在编写 GUI 应用程序,那么 Scala 可能是错误的选择,因为您不会放弃 Swing。

如果 JavaFX 最能满足您的需求,那么就使用该语言。

如果您了解 LISP,那么 Clojure 将是一个不错的选择,但是,就像 Scala 一样,听起来不是为了解决这个问题。

如果您不懂 lisp 并且想要/需要一种函数式编程语言,那么 Scala 将是最佳选择。

基本上,没有一种语言在所有情况下都是最好的,它有助于了解您想要做什么以及各种选项的优点/缺点。

The best alternate language, and the best language overall, IMO, is that which best allows you to write the program in the best model for you.

So, if you are writing a GUI app, then Scala may be the incorrect choice, as you wouldn't be moving away from Swing.

If JavaFX best meets your needs, then use that language.

If you know LISP then Clojure would be a good choice, but, like Scala, not for this problem, it sounds like.

If you don't know lisp and you want/need a functional programming language, then Scala would be the best choice.

Basically, there is no one language that is best in all situations, it helps to know what you want to do, and the strengths/weaknesses of the various options.

把昨日还给我 2024-08-13 21:18:17

这些听起来都是不错的选择。您可以将 JRuby 添加到列表中...

Those all sound like good choices. You could add JRuby to the list...

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