为什么 Ruby 和 Python 比 Groovy 更适合在 IDE 之外进行编程?
This is mainly in reference to this answer in "Python vs Groovy vs Ruby?"
What makes Python and Ruby easier to develop outside an IDE?
The link also mentions debugging in the console. What is meant by that exactly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一般来说,Python 和 Ruby 比大多数 JVM 语言更容易在 IDE 之外进行开发,因为它们需要的“开销”较少。我将主要谈论 Python,因为这是我的主要语言。
一般来说,Python 安装具有单一库源(除非您使用
virtualenv
),并且整个项目都位于文件系统上。无需担心.jar
或.class
文件 - 所有内容都在运行时编译,.py
文件是您的可分发文件。此外,Python 比 Java 更简洁,而 Groovy 继承了许多 Java 的语法(尽管它抽象了一些东西)。 IDE 有助于处理样板文件,从而减少程序员的工作量——但是没有那么多样板文件的语言不需要这种帮助。
Python and Ruby are easier to develop outside of an IDE than most of the JVM languages in general because they require less "overhead." I will speak primarily about Python, because that's my primary language.
In general, a Python installation has a single source for libraries (unless you're using
virtualenv
), and the whole project lives on the filesystem. There is no need to worry about.jar
or.class
files -- everything is compiled at runtime, and the.py
files are your distributables.Furthermore, Python is more concise than Java, and Groovy inherits a lot of Java's syntax (although it abstracts some things away). IDEs help to deal with boilerplate, making it less work for the programmer -- but languages without so much boilerplate don't require that help.
我不同意在 IDE 之外使用 Groovy 更难开发的说法。我已经完成了认真的 Python 和 Groovy 开发,以及一点点 ruby,大部分都没有 IDE。
虽然没有 pdb 风格的调试器,但有一个控制台:groovysh 是一个非 GUI 控制台、命令行应用程序,而 groovyConsole 是一个具有简单语法突出显示和编辑功能的 GUI。 Rails 和 TDD 理念强调通过测试而不是调试器进行开发,我发现如果我有良好的测试覆盖率,我很少(如果有的话)觉得需要使用完整的调试器。这对您是否重要实际上取决于您自己的开发风格。
Groovy 简化了整个
jar
/classpath
混乱。虽然您仍然可以根据需要设置类路径,但让 groovy 完全管理它要容易得多。 Groovy 自动将 jar 包含在类路径中的$GROOVY_HOME/lib
和~/.groovy/lib
中。安装库只是将其复制到那里。比这更好的是,使用@Grab,您可以在脚本顶部声明您的依赖项,groovy 将自动下载您指定的版本,并递归地获取其所有依赖项> 依赖关系并设置正确的类路径和类加载器;它甚至可以管理两个依赖于同一 jar 的不同版本的库。 Grails 也有声明性依赖。Groovy 语言本身与 ruby 或 python 一样简洁灵活。虽然您可以像成熟的 Java 一样编写它,但 groovy 也可以编写得与 ruby 非常相似。
对 groovy 与 python 和 ruby 的一个有效抱怨是 JVM 的启动时间仍然明显更差。
I disagree with the assertion that groovy is harder to develop with outside of an IDE. I've done serious python and groovy development, and a little bit of ruby, mostly without an IDE.
While there isn't a
pdb
style debugger, there's a console: groovysh is a non-GUI console, command line app, and groovyConsole is a GUI with simple syntax highlighting and editing. The rails and TDD philosophies emphasize development with tests rather than debuggers, and I find I rarely, if ever, feel the need to use a full-on debugger if I've got good test coverage. Whether this matters to you really depends on your own style of development.Groovy simplifies the whole
jar
/classpath
mess. While you can still set the classpath if you want, it's much easier to let groovy manage it entirely. Groovy automatically includes jars in$GROOVY_HOME/lib
and~/.groovy/lib
in the classpath. Installing a library is simply copying it there. Better than that, with@Grab
, you can declare your dependencies right at the top of your script, and groovy will automatically download the version you specify, and recursively get all of its dependencies and set up the proper classpath and classloaders; it can even manage two libraries that depend different versions of the same jar. Grails also has declarative dependencies.The groovy language itself is just as concise and flexible as either ruby or python. While you can write it like full-blown Java, groovy can be written to look very similar to ruby.
One valid complaint against groovy vs python and ruby is that the startup time of the JVM is still noticeably worse.
另外,例如 Ruby on Rails 包含一些原本由 IDE 处理的内容,例如生成器和控制台。
Also for example Ruby on Rails includes some things that would otherwise be handled by IDEs like generators and console.