Worse is Better


原文:http://www.jwz.org/doc/worse-is-better.html


太经典了转过来

The Rise of ``Worse is Better''
By Richard Gabriel

I and just about every designer of Common Lisp and CLOS has hadextreme exposure to the MIT/Stanford style of design. The essence ofthis style can be captured by the phrase ``the right thing.'' To sucha designer it is important to get all of the following characteristicsright:

  • Simplicity-the design must be simple, both inimplementation and interface. It is more important for the interfaceto be simple than the implementation.
  • Correctness-the design must be correct in all observableaspects. Incorrectness is simply not allowed.
  • Consistency-the design must not be inconsistent. A design isallowed to be slightly less simple and less complete to avoidinconsistency. Consistency is as important as correctness.
  • Completeness-the design must cover as many important situationsas is practical. All reasonably expected cases must be covered.Simplicity is not allowed to overly reduce completeness.

I believe most people would agree that these are good characteristics.I will call the use of this philosophy of design the ``MIT approach.''Common Lisp (with CLOS) and Scheme represent the MIT approach todesign and implementation.

The worse-is-better philosophy is only slightly different:

  • Simplicity-the design must be simple, both in implementationand interface. It is more important for the implementation to besimple than the interface. Simplicity is the most importantconsideration in a design.
  • Correctness-the design must be correct in all observableaspects. It is slightly better to be simple than correct.
  • Consistency-the design must not be overly inconsistent.Consistency can be sacrificed for simplicity in some cases, but it isbetter to drop those parts of the design that deal with less commoncircumstances than to introduce either implementational complexity orinconsistency.
  • Completeness-the design must cover as many importantsituations as is practical. All reasonably expected cases should becovered. Completeness can be sacrificed in favor of any otherquality. In fact, completeness must sacrificed whenever implementationsimplicity is jeopardized. Consistency can be sacrificed to achievecompleteness if simplicity is retained; especially worthless isconsistency of interface.

Early Unix and C are examples of the use of this school of design, andI will call the use of this design strategy the ``New Jerseyapproach.'' I have intentionally caricatured the worse-is-betterphilosophy to convince you that it is obviously a bad philosophy andthat the New Jersey approach is a bad approach.

However, I believe that worse-is-better, even in its strawman form,has better survival characteristics than the-right-thing, and that theNew Jersey approach when used for software is a better approach thanthe MIT approach.

Let me start out by retelling a story that shows that theMIT/New-Jersey distinction is valid and that proponents of eachphilosophy actually believe their philosophy is better.

Two famous people, one from MIT and another from Berkeley (but workingon Unix) once met to discuss operating system issues. The person fromMIT was knowledgeable about ITS (the MIT AI Lab operating system) andhad been reading the Unix sources. He was interested in how Unixsolved the PC loser-ing problem. The PC loser-ing problem occurs whena user program invokes a system routine to perform a lengthy operationthat might have significant state, such as IO buffers. If an interruptoccurs during the operation, the state of the user program must besaved. Because the invocation of the system routine is usually asingle instruction, the PC of the user program does not adequatelycapture the state of the process. The system routine must either backout or press forward. The right thing is to back out and restore theuser program PC to the instruction that invoked the system routine sothat resumption of the user program after the interrupt, for example,re-enters the system routine. It is called ``PC loser-ing'' becausethe PC is being coerced into ``loser mode,'' where ``loser'' is theaffectionate name for ``user'' at MIT.

The MIT guy did not see any code that handled this case and asked theNew Jersey guy how the problem was handled. The New Jersey guy saidthat the Unix folks were aware of the problem, but the solution wasfor the system routine to always finish, but sometimes an error codewould be returned that signaled that the system routine had failed tocomplete its action. A correct user program, then, had to check theerror code to determine whether to simply try the system routineagain. The MIT guy did not like this solution because it was not theright thing.

The New Jersey guy said that the Unix solution was right because thedesign philosophy of Unix was simplicity and that the right thing wastoo complex. Besides, programmers could easily insert this extra testand loop. The MIT guy pointed out that the implementation was simplebut the interface to the functionality was complex. The New Jersey guysaid that the right tradeoff has been selected in Unix-namely,implementation simplicity was more important than interfacesimplicity.

The MIT guy then muttered that sometimes it takes a tough man to make atender chicken, but the New Jersey guy didn't understand (I'm not sureI do either).

Now I want to argue that worse-is-better is better. C is a programminglanguage designed for writing Unix, and it was designed using the NewJersey approach. C is therefore a language for which it is easy towrite a decent compiler, and it requires the programmer to write textthat is easy for the compiler to interpret. Some have called C a fancyassembly language. Both early Unix and C compilers had simplestructures, are easy to port, require few machine resources to run,and provide about 50%--80% of what you want from an operating systemand programming language.

Half the computers that exist at any point are worse than median(smaller or slower). Unix and C work fine on them. Theworse-is-better philosophy means that implementation simplicity hashighest priority, which means Unix and C are easy to port on suchmachines. Therefore, one expects that if the 50% functionality Unixand C support is satisfactory, they will start to appear everywhere.And they have, haven't they?

Unix and C are the ultimate computer viruses.

A further benefit of the worse-is-better philosophy is that theprogrammer is conditioned to sacrifice some safety, convenience, andhassle to get good performance and modest resource use. Programswritten using the New Jersey approach will work well both in smallmachines and large ones, and the code will be portable because it iswritten on top of a virus.

It is important to remember that the initial virus has to be basicallygood. If so, the viral spread is assured as long as it is portable.Once the virus has spread, there will be pressure to improve it,possibly by increasing its functionality closer to 90%, but usershave already been conditioned to accept worse than the right thing.Therefore, the worse-is-better software first will gain acceptance,second will condition its users to expect less, and third will beimproved to a point that is almost the right thing. In concreteterms, even though Lisp compilers in 1987 were about as good as Ccompilers, there are many more compiler experts who want to make Ccompilers better than want to make Lisp compilers better.

The good news is that in 1995 we will have a good operating system andprogramming language; the bad news is that they will be Unix and C++.

There is a final benefit to worse-is-better. Because a New Jerseylanguage and system are not really powerful enough to build complexmonolithic software, large systems must be designed to reusecomponents. Therefore, a tradition of integration springs up.

How does the right thing stack up? There are two basic scenarios: the``big complex system scenario'' and the ``diamond-like jewel''scenario.

The ``big complex system'' scenario goes like this:

First, the right thing needs to be designed. Then its implementationneeds to be designed. Finally it is implemented. Because it is theright thing, it has nearly 100% of desired functionality, andimplementation simplicity was never a concern so it takes a long timeto implement. It is large and complex. It requires complex tools touse properly. The last 20% takes 80% of the effort, and so the rightthing takes a long time to get out, and it only runs satisfactorily onthe most sophisticated hardware.

The ``diamond-like jewel'' scenario goes like this:

The right thing takes forever to design, but it is quite small atevery point along the way. To implement it to run fast is eitherimpossible or beyond the capabilities of most implementors.

The two scenarios correspond to Common Lisp and Scheme.

The first scenario is also the scenario for classic artificialintelligence software.

The right thing is frequently a monolithic piece of software, but forno reason other than that the right thing is often designedmonolithically. That is, this characteristic is a happenstance.

The lesson to be learned from this is that it is often undesirableto go for the right thing first. It is better to get half of the rightthing available so that it spreads like a virus. Once people are hooked onit, take the time to improve it to 90% of the right thing.

A wrong lesson is to take the parable literally and to conclude that Cis the right vehicle for AI software. The 50% solution has to bebasically right, and in this case it isn't.

But, one can conclude only that the Lisp community needs to seriouslyrethink its position on Lisp design. I will say more about thislater.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
and debugged. Its widespread availability allows PCB professionals to exchange image drill and route securely and efficiently. The RS-274X format is simple, compact and unequivocal. It is easy to interpret. It describes an image with very high precision. It is complete: one single file describes an image. It is portable and easy to debug by its use of printable 7-bit ASCII characters. A well-constructed RS-274X file precisely defines the PCB image data and the functions of the different image elements. Unfortunately, poorly constructed or simply erroneous RS-274X files also circulate, sometimes leading to unjustified criticism of the format itself. Errors may be due to a misunderstanding of the format. With more than 25 years experience in CAM software we at Ucamco know which areas are most often misunderstood. This revision of the RS-274X specification explains these areas more clearly. Other files are not invalid but poorly constructed. Especially troublesome are painted or stroked pads and copper planes. Poorly constructed files take longer to process, require more manual work and increase the risk of errors. This revision of the RS-274X specification recommends constructions to make RS-274X files safer and more efficient, and hence fabrication more reliable, faster and cheaper. A few words must be said about RS-274-D or Standard Gerber. This format was developed to drive NC machine tools and was used for Gerber vector plotters in the 1960s and 1970s. It is not an image description format. It is amazing that it is still used. It is like using teletype paper tape to transfer text documents. We call on industry experts and professional organizations to discourage the use of the obsolete RS-274-D format. Although other data transfer formats have come into the market, they have not displaced RS-274X. The reason is simple. More than 90% of the problems in data transfer are due not to limitations in the RS-274X format but to poor practices and, worse, the use of RS-274
Preface Today's Internet is riddled with spammers, con artists, and identity thieves. Everywhere you turn are web sites selling fake Viagra, touting get-rich-quick schemes, or trying to trick you out of your credit card number. You and I may see through all the scams, but plenty of people do not. More than a nuisance, these are real crimes that target the vulnerable members of society such as the elderly and the naïvepeople like your parents and grandparents. Conventional wisdom says that you can never track down the people behind the scams, and that the Internet is so large and so unregulated that it is easy for someone to hide their identity. But that's not true. In every spam message, phishing email, or web page, there are all sorts of clues that reveal something about the author. The Internet address of a server and the layout of files on a web site are the online equivalents of a fingerprint on a door handle or a tire track in the mud. None of these details, by themselves, tell you a great deal. But when viewed as a whole, and, especially, when compared between cases, clear patterns and connections become apparent. As in real criminal investigations, the unlikeliest piece of evidence can turn out to be the most important. Internet Forensics shows you how to find the clues left behind at an Internet crime scene. You will learn how to uncover information that lies hidden in every email message, web page, and web server on the Internet. You will gain an understanding of how the Internet functionswhat really goes on when you request a web page, for example. You will see how the bad guys take advantage of these protocols and the lengths that they go to in order to hide their tracks. My own interest in this field has been motivated by several factors. First is the daily frustration of dealing with spam, viruses, and all sorts of scams. With it is the growing unease that our Internet is being taken away from us by these abusers and that, unless we band together and do something about it, the problem is going to get much worse. Collectively, by making it more difficult for them to operate in secrecy, we can push back against the bad guys and take back the network. In looking into this sort of scam, you are forced to learn more about the way the Internet and its core protocols function. You see where their shortcomings lie and you start to think of ways they could be made better. It is a great way to learn a lot about Internet technologies without having to become an expert in the details of any one of them. Last, but not least, is the fun to be had from playing amateur detective and solving Internet mysteries. At every stage of the game you are challenged to uncover information hidden in email message headers or web transactions. What appear to be minor details can become significant when combined with clues revealed by another technique. A passing observation in one study may link it into a much larger network of scams. Murder mysteries and forensics crime dramas in books and on television are popular for a good reason. People like the challenge of finding clues, putting them together, and solving the puzzle. I think this is particularly true among those of us in the software development community. Alongside the more noble motivations, I hope that you will enjoy the challenge of Internet forensics in its own right.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值