Beanshell翻译2

上一篇 / 下一篇  2008-09-02 20:10:41 / 个人分类:Beanshell

Beanshell翻译2

http://user.qzone.qq.com/281696143/blog/1194238416  Ronger
Introduction 介绍
This document is about BeanShell. BeanShell is a small, free, embeddable Java source interpreter with object
scrīpting language features, written in Java. BeanShell executes standard Java statements and expressions but
also extends Java into the scrīpting domain with common scrīpting language conventions and syntax.
BeanShell is a natural scrīpting language for Java.
这个文档是关于BeanShell,BeanShell是一种用Java写成的小的,自由的,可嵌入的拥有对象脚本语言特性的Java语言解释器。
Beamshell可以支持Java声明和表达式,同时可以使用通用的脚本语言习惯和语法将Java扩充进脚本领域。Beanshell对于Java来说,
是一种自然脚本语言。
scrīpting vs. Application Languages 脚本对比应用程序
Traditionally, the primary difference between a scrīpting language and a compiled language has been in its
type system: the way in which you define and use data elements. You might be thinking that there is a more
obvious difference here . that of "interpreted" code vs. compiled code. But the compiler in and of itself does
not fundamentally change the way you work with a language. Nor does interpreting a language necessarily
make it more useful for what we think of as "scrīpting". It is the type system of a language that makes it
possible for a compiler to analyze the structure of an application for correctness. Without types, compilation is
reduced to just a grammar check and an optimization for speed. From the developer's perspective, it is also the
type system that characterizes the way in which we interact with the code.
传统上说,在一个脚本语言和可编译语言之间的最初不同是在系统类型上:你定义和使用数据的方法。你可以想到解释代码和
编译代码之间的明显区别。但是编译器本身并不会从根本上改变你使用语言的方式。解释语言也不必使我们认为的脚本更加有用。
它是语言的一种系统类型,使分析程序结构和正确性成为可能。没有类型,编辑器的工作减少为仅仅语法检查和速度最优化。
从开发者的角度看,它仅仅是一种我们使用特征定义的方式来编写程序的系统类型。
Types are good. Without strongly type languages it would be very hard to write large scale systems and make
any assertions about their correctness before they are run. But working with types imposes a burden on the
developer. Types are labels and labeling things can be tedious. It can be especially tedious during certain
kinds of development or special applications where it is flexibility and not program structure that is
paramount. There are times where simplicity and ease of use is a more important criterion.
类型是很好的,没有严格的类型的语言很难写出大系统和在运行之前的关于代码正确性的验证。但是用类型语言工作对开发者来说
是一种负担。类型是标签并且所标示的对象是沉闷乏味的,在发展的软件或者是弹性很高的应用程序中这些会显得特别沉闷乏味。
有时候简单使用是一个很重要的标准.
This is not just rationalization to cover some underlying laziness. Productivity affects what people do and
more importantly do *not* do in the real world, much more than you might think. There is a lot of important
software that exists in the world today only because the cost/benefit ratio in some developer's mind reached a
certain threshold.
掩盖下面的错误是不合理的。产品影响了人们应该做什么和现实世界中认为是重要的,比你想像的要多。有很多重要的软件今天
还存在这个世界上仅仅是因为在某些开发者头脑中费用比率要在一个合理范围之内。
Unit testing . one of the foundations of writing good code . is a prime example. Unit tests for well written
code are, in general, vitally important as a collective but almost insignificant individually. It's a "tragedy of
the commons" that leads individual developers to repeatedly weigh the importance of writing another unit test
with working on "real code". Give developers have a tool that makes it easy to perform a test with a line or
two of code they will probably use it. If, moreover, it is also a tool that they enjoy using during their
development process . that saves the time, they will be even more inclined to use it.
单元测试。写出好代码的基础之一。是一个简单的例子。想写出好的代码,对于集体来说单元测试通常是极其重要的,
对于个人来说是基本上不重要的。这是一个通常的策略,可以使个人开发者重新认识到使用真实的代码写单元测试的重要性。
给开发者一个很容易用一两句代码就可以构建测试的工具,他们将有可能使用它。如果,更多的,这还是一个在发布
过程中让他们很喜欢使用的工具。那样可以节省时间,他们将更加倾向于使用它。
Customizability through scrīpting also opens the door to applications that are more powerful than the sum of
their parts. When users can extend, enhance, and add to their applications they use them in new and
unexpected ways. scrīpting is powerful.
客户通过脚本还可以打开一道应用程序的门。当用户能够扩展,增强并且将这些都带入到应用程序中是,他们可以用一些
全新或者是不可预料的方法来使用他们。脚本是强大的。
Tearing Down the Barriers  销毁屏障。
Traditionally scrīpting languages have traded in the power of types for simplicity. Most scrīpting languages
distill the type system to just one or a handful of types such as strings, numbers, or simple lists. This is
sufficient for many kinds of scrīpting.
Many scrīpting languages operate in a loose, unstructured land . a place dominated by text and
course.grained tools. As such these scrīpting languages have evolved sophisticated mechanisms for working 。
传统的脚本语言用类型的特征交换简单特征。许多脚本语言将类型系统提取为一种或者少数几种类型,比如:字符串,数字,
或简单的结合。对很多的脚本语言来说这些已经很充分。
许多脚本语言可以执行松散的,没有结构的程序,一个受控的文本和过程。一些脚本语言已经发展出久经考验的机制。
Introduction  介绍
with these simple types (regular expressions, pipes, etc.). As a result there has developed a casm between the
scrīpting languages and the application languages created by the collapse of the type system in.between. The
scrīpting languages have remained a separate species, isolated and speaking a different dialect from their
brothers the application languages.
对于这些简单的类型(通常为表达式)。结果在脚本语言和被类型系统in.between创建失败的应用程序语言之间制定了casm。
脚本语言还是一个单独的物种,孤立和说着和它的兄弟语言应用程序语言不同的语调。
BeanShell is a new kind of scrīpting language. BeanShell begins with the standard Java language and bridges
it into the scrīpting domain in a natural way, but allowing the developer to relaxing types where appropriate. It
is possible to write BeanShell scrīpts that look exactly like Java method code. But it's also possible to write
scrīpts that look more like a traditional scrīpting language, while still maintaining the framework of the Java
syntax.
Beanshell是一个全新种类的语言.Beanshell开始于标准的Java语言并且以一个自然的方式将它带入脚本领域,并且允许开发着
酌情放宽类型。完全像Java方法代码一样的书写Beanshell脚本是可能的。但是更有可能是像传统脚本语言一样书写Beanshell
脚本,同时仍然保持Java语法框架。
BeanShell emulates typed variables and parameters when they are used. This allows you to "seed" your code
with strong types where appropriate. You can "shore up" repeatedly used methods as you work on them,
migrating them closer to Java. Eventually you may find that you want to compile these methods and maintain
them in standard Java. With BeanShell this is easy. BeanShell does not impose a syntactic boundary between
your scrīpts and Java.
当需要的时候Beanshell仿效定义变量和参数。这允许你写下适当的严格类型的代码。你可以使用函数来重复调用,
将他们迁移到Java中。甚至你会发现你想去编译这些方法并且在标准Java中调用他们,对于Beanshell来说这是很容易的。
在你的脚本和Java之间Beanshell并没有硬性的句法边界。
But the bridge to Java extends much deeper than simple code similarity. BeanShell is one of a new breed of
scrīpting languages made possible by Java's advanced reflection capabilities. Since BeanShell can run in the
same Java virtual machine as your application, you can freely work with real, live, Java objects . passing
them into and out of your scrīpts. Combined with BeanShell's ability to implement Java interfaces, you can
achieve seamless and simple integration of scrīpting into your Java applications. BeanShell does not impose a
type boundary between your scrīpts and Java.
但是和Java联系的桥扩展的比简单的代码更深刻。Beanshell是通过Java的高级映射功能实现的新脚本语言之一。
既然Beanshell可以像你的引用程序一样运行在Java虚拟机中,你可以自由的调用存在的Java对象,让它们自由出
入你的脚本。结合Beanshell实现Java接口的能力,你可以将完成脚本和Java应用程序之间的无缝连接。在你的
脚本和Java之间Beanshell没有硬性的类型边界。
History 历史
What seems like an eternity ago, back in the summer of 1993, I was working at Southwestern Bell
Technology Resources and I was infatuated with the Tcl/Tk scrīpting language. On the advice of someone at
Sun I also began playing around a bit with the Oak language written by James Gosling. Little did I know that
within just a few years Oak, which would become Java, would not only spark a revolution, but that I would be
writing one of the first books on the new Java language (Exploring Java, O'Reilly & Associates) and creating
Java's first scrīpting language, BeanShell, drawing inspiration from Tcl.
看起来就像很久以前,回到1993年的夏天,我在西南地区的贝尔技术研究所工作并且我对Tcl/Tk语言很着迷。
在Sun公司的一些人的建议上我还是研究James Gosling写在Oak语言。我不知道过了一些年之后将转变成Java的语言Oak不仅
发起了一场革命,但是我将要写一本新Java语言方面的书并且创建Java的第一个脚本语言,Beanshell,我的灵感来自于Tcl.
BeanShell's first public release was not until 1997, but I had been poking at it in one form or another for some
time before that. BeanShell as a language became practical when Sun added reflection to the Java language in
version 1.1. After that, and after having seen its value in helping me create examples and snippets for the
second edition of my book, I decided to try to polish it up and release it.
Beanshell直到1997年才首次公开发布。但是在这之前我已经了解它了。当sun公司将反射加到Java1.1的时候,Beanshell作为
一zhong语言变得很流行。在这之后,并且在看到它在我的第二版书中帮助我创建实例和摘录的价值之后,我决定尝试使它更完美
并且发布它。
BeanShell has slowly, but steadily gained popularity since then. It has grown in fits and spurts as its
contributor's time has allowed. But recently BeanShell has achieved a sort of critical mass. BeanShell is
distributed with Emacs as part of the JDE and with Sun Microsystem's NetBeans / Forte for Java IDEs.
BeanShell is also bundled by BEA with their Weblogic application server. We've had reports of BeanShell
being used everywhere from the high energy physics laboratory CERN, to classrooms teaching programming
to nine year olds. BeanShell is being used in everything from large financial applications all the way down to
embedded systems floating in Buoys in the pacific ocean. I attribute this success to the power of the open
source development model and owe many thanks to everyone who has contributed.
从此之后,Beanshell慢慢的变得流行。当允许捐赠者捐赠的时候它增长的速度很快。但是最近Beanshell已经有了一批
使用者。Beanshell作为IDE的一部分分布在Emacs和Sun公司的NetBeans中。Beanshell也被BEA公司绑定在Weblogic应用
服务器中。我们已经有报告表示,Beanshell被用在从高能物理实验室CERN到给9岁孩子上课的教室中的每个地方。Beanshell
被用在从大的金融应用程序到太平洋的浮标的嵌入系统的每件事情上。我将成功归结于开源框架的力量并且感谢每个曾经
贡献力量的人。
Conclusion  结束
I believe that BeanShell is the simplest and most natural scrīpting language for Java because it is, foremost,
Java. BeanShell draws on a rich history of scrīpting languages for its scrīpting syntax and uses it to very
conservatively extend the Java language into this new domain. I hope that you have half as much fun using
BeanShell as I have had working on it and I welcome all comments and suggestions.
我相信Beanshell是Java中最简单和最自然的脚本语言。因为Java.Beanshell采用成熟的脚本语言来定义语法并且将Java语言
适当的扩充进来。我希望当你使用Beanshell的时候,你可以有我工作在上面一半的开心并且我欢迎你的评论和意见。
                             -------20080711北京


相关阅读:

TAG: Beanshell

 

评分:0

我来说两句

日历

« 2024-04-27  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 25964
  • 日志数: 25
  • 建立时间: 2008-08-27
  • 更新时间: 2008-09-02

RSS订阅

Open Toolbar