动态语言 - 我应该选择哪一种?

发布于 2024-07-25 06:33:19 字数 179 浏览 7 评论 0原文

动态语言正在兴起,其中有很多:例如 Ruby、Groovy、Jython、Scala(静态,但具有动态语言的外观和感觉)等。 我的背景是 Java SE 和 EE 编程,我想将我的知识扩展到这些动态语言之一,以便为未来做好更好的准备。

但我应该重点学习哪种动态语言?为什么? 其中哪一种将成为不久的将来的首选语言?

Dynamic languages are on the rise and there are plenty of them: e.g. Ruby, Groovy, Jython, Scala (static, but has the look and feel of a dynamic language) etc etc.
My background is in Java SE and EE programming and I want to extend my knowledge into one of these dynamic languages to be better prepared for the future.

But which dynamic language should I focus on learning and why? Which of these will be the preferred language in the near future?

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

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

发布评论

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

评论(12

落花随流水 2024-08-01 06:33:19

学习 Ruby 或 Python(以及较小程度的 Scala)意味着您将拥有非常可转移的技能 - 您可以使用 Java 版本、本机版本或 .NET 版本 (IronRuby/IronPython)。 Groovy 很好,但特定于 JVM。

除非您设想特定的场景,否则“为未来做好更好的准备”是很棘手的。 你想从事什么样的工作? 您是否有一个可以用动态语言有效实现的项目? 它是否足够小,可以试穿其中几个,以感受它们的不同之处?

Learning Ruby or Python (and Scala to a lesser extent) means you'll have very transferrable skills - you could use the Java version, the native version or the .NET version (IronRuby/IronPython). Groovy is nice but JVM-specific.

Being "better prepared for the future" is tricky unless you envisage specific scenarios. What kind of thing do you want to work on? Do you have a project which you could usefully implement in a dynamic language? Is it small enough to try on a couple of them, to get a feeling of how they differ?

嘿看小鸭子会跑 2024-08-01 06:33:19

Scala 根本不是一种动态语言。 类型推断并不意味着它是无类型的。 然而,它是一种非常好的语言,很好地融合了 OOP 和函数式编程。 唯一的问题是您一路上遇到的一些问题。

由于您已经是一名经验丰富的 Java 程序员,因此它将非常适合您的技能。 现在,如果您想一直保持动态,那么 Ruby 或 Python 都是很棒的语言。 对这两种语言都有需求。

Scala is not a dynamic language at all. Type inference doesn't mean that its untyped. However, Its a very nice language that has nice mixture of OOPs and functional programming. The only problem is some gotchas that you encounter along the way.

Since you are already an experienced Java programmer, it will fit nicely into your skillset. Now, if you want to go all the way dynamic both Ruby or Python are awesome languages. There is demand for both the languages.

紅太極 2024-08-01 06:33:19

我个人推荐 Clojure。 Clojure 是一种很棒的新语言,它的流行速度比我见过的任何语言都要快。 Clojure 是一个在 JVM 上实现的强大、简单且快速的 Lisp。 当然,它可以访问所有 J​​ava 库,就像 Scala 一样。 它已经有一本关于它的书,它已经成熟到版本 1.0,并且它有三个 IDE 插件正在开发中,这三个插件都非常有用。

I would personally recommend Clojure. Clojure is an awesome new language that is going in popularity faster than anything I've ever seen. Clojure is a powerful, simple, and fast Lisp implemented on the JVM. It has access to all Java libraries of course, just like Scala. It has a book written about it already, it's matured to version 1.0, and it has three IDE plugins in development, with all three very usable.

梦魇绽荼蘼 2024-08-01 06:33:19

我会看一下 Scala。 为什么 ?

  1. 它是一种 JVM 语言,因此您可以利用您当前的 Java 技能。
  2. 它现在有很多工具/IDE 支持(例如 Intellij 将处理 Scala 项目),
  3. 它具有功能性方面。 函数式语言目前似乎受到了很大的关注,我认为这是一个值得未来学习的范式。

我(完全主观)的观点是,Scala 似乎比 Groovy 一两年受到了更多关注前。 我并不是想在这里引起争议,或者建议它成为一种更好的语言,但它似乎是新的 JVM 语言。

顺便说一句,一种具有一些动态的语言属性是微软的F#。 我目前正在研究这个(并忽略我自己关于上面第 1 点和第 2 点的建议!)。 它是一种基于 .Net 的带有对象的函数式语言,目前引起了很多关注。

I would take a look at Scala. Why ?

  1. it's a JVM language, so you can leverage off your current Java skills
  2. it now has a lot of tooling/IDE support (e.g. Intellij will handle Scala projects)
  3. it has a functional aspect to it. Functional languages seem to be getting a lot of traction at the moment, and I think it's a paradigm worth learning for the future

My (entirely subjective) view is that Scala seems to be getting a lot of the attention that Groovy got a year or two ago. I'm not trying to be contentious here, or suggest that makes it a better language, but it seems to be the new JVM language de jour.

As an aside, a language that has some dynamic attributes is Microsoft's F#. I'm currently looking at this (and ignoring my own advice re. points 1 and 2 above!). It's a functional language with objects, built on .Net, and is picking up a lot of attention at the moment.

听不够的曲调 2024-08-01 06:33:19

在游戏行业Lua,如果你是一个基于Adobe的设计师Lua也不错,如果你是一个嵌入式程序员Lua实际上是唯一的轻量级解决方案,但如果你正在研究Web开发和通用工具脚本Python会更实用

In the game industry Lua, if you're an Adobe based designer Lua is also good, if you're an embedded programmer Lua is practically the only light-weight solution, but if you are looking into Web development and General tool scripting Python would be more practical

皇甫轩 2024-08-01 06:33:19

我发现 Groovy 是从广泛的 Java 背景中相对容易跳转的——它是一种更方便的 Java 版本。 如果您需要做这类事情,它也可以与现有的 Java 代码很好地集成。

I found Groovy to be a relatively easy jump from an extensive Java background -- it's sort of a more convenient version of Java. It integrates really nicely with existing Java code as well, if you need to do that sort of thing.

作死小能手 2024-08-01 06:33:19

我推荐Python。 它有一个庞大的社区,并且有一个成熟的实现(以及几个有前途的、不太成熟的)。 据我所知,与较新的语言相比,Perl 失去了很多吸引力,大概是由于它的“非直观性”(不,别让我开始说这个)。

当您用 Python 完成一两个项目后,请继续做其他事情以获得更广泛的视角。 如果您已经使用两种不同的动态语言完成了一些重要的事情,那么您在同化任何其他语言时就不会有任何问题。

I'd recommend Python. It has a huge community and has a mature implementation (along with several promising not-so-mature-just-yet ones). Perl is as far as I've seen loosing a lot of traction compared to the newer languages, presumably due to its "non-intuitiveness" (no, don't get me started on that).

When you've done a project or two in Python, go on to something else to get some broader perspective. If you've done a few non-trivial things in two different dynamic languages, you won't have any problems assimilating any other language.

浅沫记忆 2024-08-01 06:33:19

JScript 非常有用,而且它确实是一种动态语言......

JScript is quite usefull, and its certainly a dynamic language...

歌入人心 2024-08-01 06:33:19

如果您想要一种具有大量模块的语言(几乎适用于任何东西!),请选择 Perl。 借助其CPAN,您总能找到您想要的东西,而无需重新发明轮子。

If you want a language with a good number of modules (for almost anything!), go for Perl. With its CPAN, you will always find what you want without reinventing the wheel.

多彩岁月 2024-08-01 06:33:19

记住您的背景,我会推荐一种语义与您所了解的相似的语言。 因此,像 Scala、Fan、Groovy 这样的语言将是一个很好的起点。一旦您掌握了使用函数式语言的基本语义(并开始喜欢它),您就可以转向像 Ruby 这样的语言。 通过这种方式,您的周转时间会减少,并且您可以成为一名多语言程序员。

Well keeping in mind your background, i would recommend a language where the semantics are similar to what you are aware of. Hence a language like Scala, Fan, Groovy would be a good starting point.Once you get a hang of the basic semantics of using a functional language(as well as start loving it), you can move onto a language like Ruby. The turn around time for you in this way gets reduced as well as the fact that you can move towards being a polyglot programmer.

帝王念 2024-08-01 06:33:19

我会为 Groovy(和 Grails)投 +1 票。 您仍然可以使用 Java 风格或 Groovy 进行输入(您也可以混合使用两者,不用担心)。 您也可以使用 Java 库。

i would vote +1 for Groovy (and Grails). You can type with Java style or Groovy still (you can also mix both and have no worry about that). Also you can use Java libs.

素手挽清风 2024-08-01 06:33:19

作为一般规则,避免使用动态类型语言。 编译时检查的损失和强静态类型的自记录性质非常值得将类型信息放入源代码中。 如果编写代码时需要执行的额外输入工作量太大,那么具有类型推断功能的语言(Scala、Haskell)可能会感兴趣。

拥有类型信息可以使代码更具可读性,而可读性应该是编码中的第一标准。 对于一个人来说,阅读代码是昂贵的,任何阻碍读者清晰、准确理解的事情都是一件坏事。 在面向对象语言中情况更糟,因为你总是在创建新类型。 刚刚熟悉的读者会感到困惑,因为他们不知道正在传递和修改的类型。 例如,在 Groovy 中,以下是合法的 def accountHistoryReport(in, out) 读到它,我不知道 inout 是什么。 当你看到 20 种看起来像这样的不同报告方法时,你很快就会彻底杀人。

如果您确实认为必须具有非静态类型,那么像 Clojure 这样的语言是一个很好的折衷方案。 类似 Lisp 的语言构建于一小组关键抽象以及每个抽象的大量功能之上。 因此,在 Clojure 中,我将创建一个具有对象属性的映射(哈希)。 这有点简化,但我不必查看整个代码库来实现某些未命名的类。

我的经验法则是用动态语言编写脚本,用编译的静态类型语言编写系统。

As a general rule, avoid dynamically typed languages. The loss of compile time checking and the self-documenting nature of strong, static typing is well worth the necessity of putting type information into your source code. If the extra typing you need to do when writing your code is too great an effort, then a language with type inference (Scala, Haskell) might be of interest.

Having type information makes code much more readable, and readability should be your #1 criteria in coding. It is expensive for a person to read code, anything that inhibits clear, accurate understanding by the reader is a bad thing. In OO languages it is even worse, because you are always making new types. A reader just getting familiar will flounder because they do not know the types that are being passed around and modified. In Groovy, for example, the following is legal def accountHistoryReport(in, out) Reading that, I have no idea what in and out are. When you are looking at 20 different report methods that look just like that, you can quickly go completely homicidal.

If you really think you have to have non-static typing, then a language like Clojure is a good compromise. Lisp-like languages are built on a small set of key abstractions and massive amount of capability on each of the abstractions. So in Clojure, I will create a map (hash) that has the attributes of my object. It is a bit reductionalist, but I will not have to look through the whole code base for the implementation of some un-named class.

My rule of thumb is that I write scripts in dynamic languages, and systems in compiled, statically typed languages.

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