首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
外语
Programming Languages Programming languages are how people talk to computers. The computer would be just as happy speaking a
Programming Languages Programming languages are how people talk to computers. The computer would be just as happy speaking a
admin
2010-02-26
52
问题
Programming Languages
Programming languages are how people talk to computers. The computer would be just as happy speaking any language that was unambiguous. The reason we have high level languages is because people can’t deal with machine language. The point of programming languages is to prevent our poor frail human brains from being overwhelmed by a mass of detail.
Architects know that some kinds of design problems are more personal than others. One of the cleanest, most abstract design problems is designing bridges. Them your job is largely a matter of spanning a given distance with the least material. The other end of the spectrum is designing chairs. Chair designers have to spend their time thinking about human bodies. Software varies in the same way. Designing algorithms (运算法则) for routing data through a network is a nice, abstract problem, like designing bridges. Whereas designing programming languages is like designing chairs: it’s all about dealing with human weaknesses.
Most of us hate to acknowledge this. Designing systems of great mathematical elegance sounds a lot more appealing to most of us than pandering to human weaknesses. And there is a role for mathematical elegance: some kinds of elegance make programs easier to understand. But elegance is not an end in itself. And when I say languages have to be designed to suit human weaknesses, I don’t mean that languages have to be designed for bad programmers. In fact I think you ought to design for the best programmers, but even the best programmers have limitations. I don’t think anyone would like programming in a language where all the variables were the letter x with integer subscripts. If you look at the history of programming languages, a lot of the best ones were
languages designed for their own authors to use, and a lot of the worst ones were designed for other people touse.
When languages are designed for other people, it’s always a specific group of other people: people not as smart as the language designer. So you get a language that talks down to you. Cobol (计算机通用语言) is the most extreme case, but a lot of languages are pervaded by this spirit. It has nothing to do with how abstract the language is. C is pretty low-level, but it was designed for its authors to use, and that’s why hackers like it. The argument for designing languages for bad programmers is that there are more bad programmers than good programmers. That may be so. But those few good programmers write a disproportionately large percentage of the software.
I’m interested in the question, how do you design a language that the very best hackers will like? I happen to think this is identical to the question, how do you design a good programming language?
Give the Programmer as Much Control as Possible.
Many languages (especially the ones designed for other people) have the attitude of a governess: they try to prevent you from doing things that they think aren’t good for you. I like the opposite approach: give the programmer as much control as you can. When I first learned Lisp (表处理语言), what I liked most about it was that it considered me an equal partner. In the other languages I had learned up till then, there was the language and there was my program, written in the language, and the two were very separate. But in Lisp file functions and macros I wrote were just like those that made up the language itself. I could rewrite the language if I wanted. It had the same appeal as open-source software.
Aim for Brevity.
Brevity is underestimated and even scorned. But if you look into the hearts of hackers, you’ll see that they really love it. How many times have you heard hackers speak fondly of how in, say, APL, they could do amazing things with just a couple lines of code? I think anything that really smart people really love is worth paying attention to. I think almost anything you can do to make programs shorter is good. There should be lots of library functions; anything that can be implicit should be; the syntax (句法) should be simple; even the names of things should be short.
And it’s not only programs that should be short. The manual should be thin as well. A good part of manuals (说明书) is taken up with clarifications and reservations and warnings and special cases. If you force yourself to shorten the manual, in the best case you do it by fixing the things in the language that required so much explanation.
Admit What Hacking Is.
A lot of people wish that hacking was mathematics, or at least something like a natural science. I think hacking is more like architecture. Architecture is related to physics, in the sense. that architects have to design buildings that don’t fall down, but the actual goal of architects is to make great buildings, not to make discoveries about statistics. What hackers like to do is make great programs. And I think, at least in our own minds, we have to remember that it’s an admirable thing to write great programs, even when this work doesn’t translate easily into the conventional intellectual currency of research papers. Intellectually, it is just as worthwhile to design a language programmers will love as it is to design a horrible one that embodies some idea you can publish a paper about.
How to Organize Big Libraries?
Libraries are becoming an increasingly important component of programming languages. They’re also getting bigger, and this can be dangerous. If it takes longer to find the library function that will do t you want than it would take to write it yourself, then all that code is doing nothing but make your manual thick. So I think we will have to work on ways to organize libraries. The ideal would be to design them so that the programmer could guess what library call would do the right thing.
Are People Really Scared of Prefix Syntax?
This is an open problem in the sense that I have wondered about it for years and still don’t know the answer. Prefix syntax seems perfectly natural to me, except possibly for math. But it could be that a lot of Lisp’s unpopularity is simply due to having an unfamiliar syntax. Whether to do anything about it, if it is true, is another question.
What Do You Need for Server (服务器)-Based Software?
I think a lot of the most exciting new applications that get written in the next twenty years will be Web- based applications, meaning programs that sit on the server and talk to you through a Web browser. And to write these kinds of programs we may need some new things. One thing we’ll need is support for the new way that server-based applications get released. Instead of having one or two big releases a year, like desktop software, server-based applications get released as a series of small changes. You may have as many as five or ten releases a day. And as a rule everyone will always use the latest version.
You know how you can design programs to be debug gable (调试器)? Well, server-based software likewise has to be designed to be changeable. You have to be able to change it easily, or at least to know what is a small change and what is a momentous one. Another thing that might turn out to be useful for server based software, surprisingly, is continuations. In Web-based software you can use something like continuation- passing style to get the effect of subroutines in the inherently stateless world of a Web session. Maybe it would be worthwhile having actual continuations, if it was not too expensive.
What New Abstractions Are Left to Discover?
I’m not sure how reasonable a hope this is, but one thing I would really love to do, personally, is discover a new abstraction--something that would make as much of a difference as having first class functions or recursion or even keyword parameters. This may be an impossible dream. These things don’t get discovered that often. But I am always looking for.
Hackers could do amazing things in APL with just______.
选项
答案
a couple lines of code
解析
本题同样是细节题,答案在第二个黑色小标题下第二句“How many times have you heard hackers speak fondly of how in,say, APL,they could do amazing things with just a couple lines of code?"题干与原文有出入。
转载请注明原文地址:https://kaotiyun.com/show/vbOK777K
0
大学英语六级
相关试题推荐
It’ssaidthatGov.JonCorzinesufferedfromaseverinjuryprobablybecause______.Accordingtothepassage,whoarestilln
A、LendMarshasomereferencematerials.B、AskMarshawherethebookshelfis.C、CheckthroughthebooksonMarsha’sshelf.D、Ask
A、Itshabit.B、Itsgenes.C、Itsmentalstate.D、Itsphysicalcondition.BAccordingtothespeaker,whatisthesleeppatternofa
A、Sheiswritingacompetitivepaperforascholarship.B、Sheisdoingaresearchpaper.C、Shemissedthelecture.D、Sheisplan
Bytheearly1900’s,manypeopleintheUnitedStatesbegantoworryabouttheuseofalcoholbycitizens.Itwaspossiblethatt
Forthispart,youareallowed30minutestowriteashortessayentitledToCurbSpending?Youshouldwriteatleast150words
A、TheUSshouldcatchuptoEuropeanenvironmentalstandards.B、AmericanexportersmustadapttonewregulationsinEurope.C、Th
FlyingObjectsItissometimesreportedthatstrangeobjectshavebeenseenhighupintheair.TheseUnidentifiedFlyingOb
OnlytwomajorAmericanfilmforms—theslapstickcomedyandthewestern—withstoodtheeffectsofforeigninfluencesthroughoutt
A、Thewomanismakingmovieswithcomputers.B、Themanisstudyingfineartsasamajor.C、Thewomanhasrealtalentforcompute
随机试题
关于中度脱水丢失体液量的描述,正确的是
某省海兴市的《现代企业经营》杂志刊登了一篇自由撰稿人吕某所写的报道,内容涉及到同省龙门市甲公司的经营方式。甲公司负责人汪某看到该篇文章后,认为《现代企业经营》作为一本全省范围内发行的杂志,其所发文章内容严重失实。损害了甲公司的名誉,使公司的经营受到影响。于
依据《烟花爆竹安全管理条例》的规定,进入仓库区的机动车辆必须有防火花装置,且速度不得超过()km/h。
关于报关员考核记分,下列表述正确的有( )。
下列属于非货币性资产交换的有()。Ⅰ.以其他应收款换入投资性房地产Ⅱ.以持有至到期债券投资换入固定资产Ⅲ.以交易性金融资产换入长期股权投资Ⅳ.以公允价值100万元专利技术和公允价值30万元应收账款换入一批存货
甲公司是一家健身器材销售公司,为增值税一般纳税人,适用增值税税率为17%。2013年1月1日,甲公司向乙公司销售5000件健身器材,单位销售价格为1000元,单位成本为800元,开出的增值税专用发票上注明的销售价格为5000000元,增值税额为85000
古罗马的西塞罗曾说:“优雅和美不可能与健康分开。”意大利文艺复兴时代的人道主义者洛伦佐.巴拉强调说,健康是一种宝贵的品质,是“肉体的天赋”,是大自然的恩赐。他写道:“很多健康的人并不美,但是没有一个美的人是不健康的。”以下各项都可以从洛伦佐?巴拉
阅读下列说明,回答问题1至问题3,将解答填入答题纸的对应栏内。【说明】某项目由A、B、C、D、E、F、G、H活动模块组成,下表给出了各活动之间的依赖关系,以及它们在正常情况和赶工情况下的工期及成本数据。假设每周的项目管理成本为10万元,而且项目
中秋节将至,给客户张经理发一封邮件,送上自己的祝福。新建一封邮件,收件人为:zhangqiang@sina.com,主题为:中秋节快乐!内容为:张总,祝您节日快乐,身体健康,工作顺利!
Whatdoesthemansuggest?
最新回复
(
0
)