it permitted rapid development, often regarded as merely "rapid prototyping," but subsequently recognized as a kind of agile programming(它允许更快速的开发,以前,这仅仅被认为是"快速原型方法",而后来,人们把它叫做敏捷编程);
it provided the kind of high-level programming that had always been envisioned in the ascent from lowlevel assembly language programming to higher levels of abstraction(它是一种高级语言,符合从汇编语言到更高级语言抽象的一贯趋势)—it was concise and shielded programmers from concerning themselves with many performance and memory management details;
it was well suited to working with data in heterogeneous, mixed-user settings where the majority of a programming task consisted of transforming user data, as opposed to the connecting of components, which Java did well, or the control of a well-designed system, which was C++'s realm(它特别适合于在异构环境和混杂的用户设置的环境下工作--这样的环境下的主要任务是 各种用户数据间的转换;而Java适合于连接不同组件;C++则适合于设计良好的系统下的控制。这样,它们各有优势,形成互补。); and
it was easier to get things right with short source code, in which code that was not too terse or verbose determined behavior, when all types could be coerced into strings for debugging, when identifiers were short, and when programmers could turn ideas into code quickly without losing focus(程序员可以很快抓住代码中的思想,不易分散注意力).
This last point was extremely counterintuitive. Strong typing, a naming regimen, and verbosity were supposed to help programmers avoid errors(最后一点似乎违背直觉,通常认为,规范的命名,强制类型声明,冗余说明,会帮助程序员避免错误). But the programmers who had to generate too many keystrokes and consult too many pages, who had to search through many different files to be sure of semantics, who had to follow too many rules, and who had to sustain motivation and concentration over a long period, became distracted and consequently inefficient(但是,程序员必须敲太多键盘,写太多页代码,在不同文件之间查询,长时间保持积极性和注意力,最后变得心烦意乱而导致低效率). The language's promise to discipline the programmer quite simply did not reduce the tendency of humans to err. It exchanged one kind of frequent error for another.
Independent minds(独立的思想)
Scripting languages became the distinctive tools of independent-minded programmers: the hackers, yes, but also the gifted and genius programmers who tended to drive a project's design and development, according to Paul Graham. 3 Scripting became the mark of autodidacts, prodigies, and Third World programmers, the inspired class, the people who had never had to "think outside the box" because they had never been stuck inside it.
Proper and professional software engineering supposedly permits managers to level the playing field and extract considerable productivity from less talented and less motivated programmers. This makes software productivity a commodity, and programmers become disposable and exchangeable. Scripting does not promise this kind of disposability(规范和专业的软件工程学被认为可以提升企业的竞争力,能让缺乏天赋和积极性的程序员产生高的生产率。这让软件生产力变成商品,程序员像机器零件一样随时可更换). Some languages, notably Python, Php, and Ruby, can support large-scale professional software engineering practice, but they are also quite usable by the rugged individual, the eccentric, and the rebel.
A corollary to this difference between the mundane(超然) and the liberating(平凡): Scripting was not enervating but actually renewing. Programmers who viewed code generation in "real languages" as tedious and tiresome viewed scripting in contrast as rewarding self-expression or recreation. (脚本没有被削弱,反而得到复兴。程序员认为那些"真正的编程语言"呆板无聊,而脚本才是自我表现的好机会)
Semantics
The distinct characteristics of scripting languages that produce these effects are usually enumerated as semantic features, starting with low I/O specification costs, the use of implicit coercion and weak typing, automatic variable initialization with optional declaration, predominant use of associative arrays for storage and regular expressions for pattern matching, reduced syntax, and terse control structures.
(脚本语言之所以有这样的效果,是因为它们鲜明的特性 —— 一般被归类为语义特性:I/O规格说明的简洁,弱类型,变量自动初始化,关联数组,正则表达式模式匹配,简练的语法,紧凑的控制结构)
But the main reason for the productivity gains can be found in the name scripting itself. Scripting powerfully embeds a developer in an environment. In the same way that the dolphin reigns over the open ocean, Lisp provides a powerful language for those who would customize their Emacs, JavaScript is feral among browsers, and many older scripting beasts still rule the Linux jungle(脚本把开发者嵌入到某个环境中。就像海豚统治着开阔的海洋,Lisp给那些想自己定制Emacs的人提供强大的工具;JavaScript在浏览器之间所向无敌,而许多古老的脚本猛兽依然统治着Linux丛林).
The basic idea of scripting even includes a hint of AI: The scripting language grants high-level control to automate by capturing the intentions and routines normally provided by a user or administrator. If recording and replaying macros simulates a kind of autopilot, then scripting offers a kind of proxy for human decision-making
(脚本的基本思想中甚至包含着人工智能的暗示:脚本语言能通过捕捉用户和管理者自然的意图和例程,提供高层的自动控制。如果说录制和播放宏模拟了一种自动驾驶,那么脚本提供了一种代理来替人类自动决策). Nowhere is this clearer than in one-line embedded Php, or in sysadmin shell scripting, or in the scripting of artificial agents in computer games.
Current Claims (目前的主张)
Back to Top
While it might have been risky for Ousterhout to proclaim scripting on the rise in 1998, it would be folly to dismiss the success of scripting today. Scripting languages are excellent choices for CS1. To me, Java-based CS1 is the single greatest mistake in the history of computing curricula. Students should learn to love their own possibilities before they learn to loathe other people's restrictions(如果说奥斯特霍特1998年就宣称脚本编程正在崛起有些风险,那么今天还否定脚本编程的成功就显得很愚蠢了。脚本语言是第一门编程课程的极佳选择。在我看来,用Java作为第一门授课语言是计算机课程历史上最大 的错误。学生们在学会厌恶来自别人的限制之前,应该学会珍惜他们自己拥有的各种可能性).
There is a lot of the old fascist-versus-anarchist dispute here, but there is also empirical evidence. I reported in 1996 4 that only the scripting programmers could generate code fast enough to keep up with the demands of the artificial intelligence laboratory class. Even though students could choose any language they wanted, and many had to unlearn top-down ways of doing things, few could turn new ideas into code without scripting. In the intervening decade, little has changed(我在1996年报道过只有脚本程序员能够足够快地编写程序,跟上人工智能实验课程的需求。尽管学生可以选择自己想用的任何语言,并且许多人抛弃了自顶向下做事情的方法,如果不用脚本编程很少有学生能将新想法变成代码。在这十年间,这种现象基本没什么变化).
Students who learn to script early are empowered throughout their college years, especially in the crucial Unix and Web environments. Those who learn Java and C++ first are stifled by enterprise-sized correctness. Early programmers must learn to be creative and inventive, and they need programming tools that support exploration rather than production. Software engineering aesthetics should come after programming, not the other way around(早学会脚本编程的学生,在大学学习的整个过程中都会非常受用,特别是在至关重要的Unix和万维网环境下。而首先学习Java和C++语言的学生却被企业规模的正确性所抑制。初级程序员必须学习如何创造和发明。他们需要的编程工具应更多支持探索而不是生产。软件工程的美学应该在变成学习之后,而不是相反).
Scripting CS1 (基于脚本的初级编程课程)
What scripting language could be used for CS1? I personally prefer Gawk, JavaScript, Php, and Asp, mainly because of their gentle learning curves. I don't think Perl would be a disaster; its imperfection would create many teaching moments. But an emerging consensus in the scripting community holds that Python is the right solution for freshman programming. Ruby would also be a defensible choice(什么样的脚本编程语言适合用于第一门编程课?我个人倾向于Gawk,JavaScript, Php 和Aspects,主要是因为它们具有比较平缓的学习曲线。我不觉得Perl一无是处,它的不完美能够创造很多教学点。但是脚本编程界已经出现一个共识,认为Python适合新生编程课程。Ruby也是一个经得起推敲的选择).
Python and Ruby have the enviable properties that almost no one dislikes them, and almost everyone respects them. Both languages support a variety of programming styles and paradigms and satisfy practitioners and theoreticians equally. Both languages are carefully enough designed that developers can demonstrate "correct" programming practices and enforce high standards of code quality. That Google stands by Python provides added motivation for undergraduate majors. Google originally used Python because Scott Hassan, who wrote much of the prototype for Brin and Page, had been mentored by an early Python guru and because I was unable to convince him over many years in St. Louis to switch to Gawk or Perl (Python和Ruby都有很好的性质,受到几乎所有人的欢迎。两种语言都支持各种各样的编程方式和方法,同时满足实践者和理论家的需求。它们都经过了精心的设计,使开发者能展示'正确的'编程实践,保障代码质量的高标准。Google支持Python更有利于它被计算机专业接受。Google最初使用Python是因为斯科特(Scott Hassan)这个人,他为布林和佩奇(Sergey Brin and Larry Page,Google的创始人)写了大部分原型系统,斯科特曾得到一个早期Python权威的指导,而我在圣路易斯作了很多努力都没能说服他使用Gawk或者Perl).
But do scripting solutions scale? What about the performance gap when the algorithm faces large n? What about software engineering on big projects? There has been extensive discussion about scriptings' scalability. In the past, these debates have simply ended with the concession that developers must rewrite large systems in C or C++, once the scripting had served its prototyping duty.
Multiple languages (多种语言)
Indeed, scripting languages are not the answer for long-lasting, CPU-intensive nested loops. Matrix multiplication is simply faster in other languages(确实,对于长时间运行的,CPU使用密集的嵌套循环,脚本是不合适的答案。在其他语言中矩阵乘法当然会更快). Developers can easily identify such bottlenecks and rewrite the code in a more appropriate language. But a harder language or one with blackbox libraries of objects and methods does not always offer the best performance choice.
Often, we see that a team did not implement efficient data organization because it would have required more code—code that they would have attempted and likely successfully written in an easier programming language. We saw this in the AI class with heuristic search and computer vision, where brute force is better in C, but complex heuristics are better than brute force, and scripting is better for complex heuristics(我们在人工智能可中看到这样的现象,这些课中需要启发式搜索和计算机视觉,其中的蛮力搜索更适合在C语言中实现,但复杂的启发式算法比蛮力搜索更好,而写复杂的启发式搜索时用脚本编程就更合适).
When algorithms are exponential, it usually doesn't matter what language developers use because most practical n will incur too great a cost. Again, the solution is to write heuristics, and scripting is the top dog in that house. Processors are so much faster than disks these days that a single extra disk read can erase the CPU advantage of using a compiled language instead of an interpreted one(当算法具有指数复杂性时,开发着用什么样的语言已经无关紧要,因为大部分实际的n都是引起过高的代价。这里的解决方案还是用启发式算法,而脚本编程是为启发式算法编程的最好选择。现在处理器的速度远远快于磁盘操作的速度,以至于一个额外的磁盘读操作,都会把由于使用编译语言而不用解释性语言所得到的处理器优势给淹没的无影无踪).
Programmers also benefit from using multiple paradigms and languages. Projects can and do contain a mix of scripting, high-performance programming, and professional componentware. I weep when I think about the text processing written in C under my managerial watch because the programmer didn't know Perl(当我想到那些在我管理下的工作中,程序员不懂Perl而用C语言编写的文本处理,就不由得扼腕). Considering that there are much better scripting tools for much of what gets programmed in Java and C++, perhaps the question should be whether Java and C++ scale to enterprise projects.
Pragmatics
Back to Top
(待补充)
References
- [1] J.K. Ousterhout, "Scripting: Higher Level Programming for the 21st Century," Computer,Mar. 1998, pp. 23 30.
- [2] D. Spinellis, "Java Makes Scripting Languages Irrelevant?" IEEE Software, vol. 22, no. 3, 2005, pp. 70 71.
- [3] P. Graham, Hackers and Painters, O'Reilly, 2004.
- [4] R.P. Loui, "Why Gawk for AI?" SIGPLAN Notices, vol. 31, no. 8, 1996, pp. 8 9.
- [5] S. Levinson, Pragmatics, Cambridge University Press, 1983.
- [6] L. Prechelt, "An Empirical Comparison of Seven Programming Languages," Computer, vol. 33, no. 10, 2000, pp. 23 29.
- [7] M.L. Scott, Programming Language Pragmatics, Morgan Kaufmann, 2000.
Ronald P. Loui is an associate professor of computer science and engineering at Washington University in St. Louis. His research interests include Web programming, artificial intelligence, and hardware-software codesign. Loui received a PhD in computer science from the University of Rochester. Contact him at
[email protected].
中文原译者:朱燕民 上海交大讲师 ,主要研究 计算机网络与分布式系统的算法设计,性能分析和优化设计。
本文中的中文译注参考朱老师的译文,有些地方简化和改动。
最后一部分 progmatics(语用)太有深度,我自己还没看懂,等我看懂了,再另外补充进来。
找茬脑洞的世界安卓版
休闲益智 下载
滑板英雄跑酷2手游
休闲益智 下载
披萨对对看下载
休闲益智 下载