实例介绍
英文PDF版。 《编程大师访谈录》是对19 位计算机行业先驱的采访实录,采访对象包括查尔斯·西蒙尼、比尔·盖茨、安迪·赫兹菲尔德、雷·奥奇、杰夫·拉斯金等。访谈涉及他们软件创造过程的灵感、技术、编程习惯、动机、反思,以及对未来软件的畅想等。问答中集结了这些计算机先驱的精辟言论,处处闪烁着智慧的火花。
Charles simonyi Born on September 10, 1948 in Budapest, Hungary, Charles Simonyi was introduced to computers and programming whilc attending high school, when his father arranged for him to assist an engineer who was working on one of the few computers in Hungary at the time By 1966 Charles had not only completed high school but also his first compiler. With the cxpcricncc gaincd from writing the compiler, hc was ablc to obtain employment at A/S Regnecentralen in Copenhagen, Denmark. In 1968 Charles left denmark to study in the United States at the University of California at Berkeley, where he received his bachelor of science degree in 1972, and his doctorate degree from Stanford University in 1977 Simonyi has worked at the uc Berkeley Computer Center, the berkeley Computer Corporation, the iLliac 4 Project, Xerox PARC, and, since 1981, Microsoft Corporation. While at Xerox, Charles created the bravo and bravo X programs for the alto personal computer. At Microsoft Charles organized the Application Software Group, which has produced Multiplan, Microsoft Word, Microsoft Excel, and othcr popular application products Almost everywhere here in the microcomputer world. Charles Simonyi has made his mark, either by something he has accomplished or by influencing someone with whom he has worked. He's a modest but spirited fcllow, quick to smile and ablc to comment on just about any topic, computcr related or not During the two times we met with Charles, once over lunch and the other time in his office, the conversations ranged from thc attributes of Microsoft Excel, to flying helicopters, to ccrtain facts of modern poetry. His speech is distinguished by a Hungarian accent which has become Charles trademark both in speaking and programming Clad almost daily in a uniform of weathered jeans jacket, shirt, and worn jeans, he retains the appearance of a Berkeley student during the sixties, but his breadth of knowledge, manner and accomplishments exhibit a wealth of wisdom and cxncricncc INTERVIEWER: Your first computer program was done before you graduated from high school in hungary, correct? SIMONYI: Yes. There is my first program and then my first professional program. The first program I ever wrote filled in a magic square, where all the columns and rows added up to the same sum. I programmed it into an ancient tube computer. I spent the whole afternoon pushing buttons just to enter it into thc machinc. That cvcning, I arrived homc with an incredible hcadachc and giant rolls of paper with printouts of 80-by-80 magic squares. That was in 1964 INTERVIEWER: What was the first computer you worked on? http://programmersatwork.wordpress.com SIMONYI: It was a Russian-made computer, a Ural II. It had only 4K of memory, a 40-bit floating point, and 20-bit operations. The computer was programmed totally in octal absolute [no assembler I wrote thousands of lines of code in octal absolute. All the action in this computer was directed through the console; it was truly a hands-on, one-on one experience. Programmers didn,t have to stand around waiting for a computer operator to run a batch of cards. The Ural II was exactly like a personal computer because it was just you and the machinc and no onc clsc. With 4K of memory and thc slow spccd, it was vcry similar to the altai Thich was introduced in 1974. The excitement I experienced with the Ural l in 1964 was the same kind of excitement that Bill Gates experienced with the altair in 1974 Obviously, thc Ural iI differed from a personal computcr in some respects. Thc Ural II was thc sizc of a very, very large room and the method for input and output was incredibly primitive--primarily through console switches. The console looked like an old-fashioned cash register. There were six full columns of switches and an enter key on the right each column had keys numbered from zero to seven. You entered numbers just like you would on a cash register. So to enter 2275, you pushed the keys for two, two, seven, and five. If you made a mistake, you could correct it before pushing the enter key on the right. all this was exhilarating because there was a lot of noise associated with it. Every time I hit the switch, it clicked very firmly. Whenever I cleared it-it was all done mechanically--all the keys released at once with a great"thunk INTERVIEWER: What was your first professional program? SIMONYI: The first professional program that I wrote was a compiler for a very simple FORTRAN-likc, high-lcvcl language. I sold it to a statc organization as an innovation and madc a fair amount of money, none of which I ever spent, since I left Hungary soon after It was during this time that I met some Danish computer people at a trade fair in Budapest. I approached them and got a lot of information about thcir ncw machinc at the next tradc fair I came prepared with a small demonstration program I had written. It provided feedback on exactl which part of a lengthy expression the machine was analyzing at any point in time. I asked one of the guys to take the program back to Denmark and show it to somebody in charge. They must have liked it because they gave me a job. That's how I got out of Hungary I worked for a year and a half at the programming job in Denmark and saved enough money to go to the University of California at Berkeley. I became a programmer at the computer center there. I made just enough money to pay for the tuition While i was at Berkeley I wrote a very nice SNOBOL compiler. One of the computer science professors, Butler Lampson, liked the compiler very much and had his computer science students use it in class. When he and a bunch of other professors started Berkeley Computer Corporation, I was offered a job there. When bCC went under, the core group was picked up by Xerox PARC INTERVIEWER: Who influenced your style of prograrnming? http://programmersatwork.wordpress.com SIMONYI: I had two influences--an engineer in Hungary and the computer I worked on in Denmark. My mentor in Hungary was an engineer who worked on the ural li computer I was kind of a groupie, just being underfoot and offering free services in exchange for being tolerated in a placc whcrc I wasn't supposed to be. This was not a placc for kids. It was onc of maybe fivc computers in all of Hungary and was considered a great asset INTERVIEWER: How did you manage lo get underfooL? SIMONYI: My father was a professor of electrical engineering and this engineer was a student of my father's. I think my father asked him to let me in once as a favor. I made myself useful. First I brought him lunch. then i held the probes, and finally i offered to be a night watchman They always turned the computer off at night and turned it back on in the morning When you turn tubes off and on the filaments tend to break when they are cooled and heated In a machine with two thousand tubes, one will break every time you turn the machine on. So they had to spend the first hour of every workday finding the one that broke. When I was there at night, they could leave the computer on and save all that work. So while i was watching it at night, I also managed to use it Anyway, the engineer and i became good friends. He was a mathematical genius. He taught me many ot mc carly tricks about how to think arithmetically, about symbolic problcms The Danish computer also had an incredible influence on me. At that time, it had probably the world's best Algol compiler, called Gier Algol. Before I went to Denmark, I had complete listings of the compiler, which i had studicd insidc and out. It was all written in machinc language, so it was both a lesson in machine-language programming and an aesthetically beautiful way of thinking about a compilation process. It was designed by Peter Naur. He is the letter N in bNF, the backus Naur Form of syntax equations. I knew that program inside and out and I still know it The SNObOl compiler I wrote at Berkeley, for example, was just a variation on the same theme. I think the Gier Algol program is still in my mind and influences my programming today. I always ask myself, "lf this were part of the algol compiler how would they do it It's a very very clever program One notion that sticks in my mind is how they scanned the source text backwards. It turns out that in some cases, if you do things backwards, problems that previously appeared complex suddenly become very simple. For instance, resolving forward references can be difficult. If you scan backwards, thcy bccomc backward rcfcrcnccs, which arc casy to resolve. Just by looking at a program in a new way, what formerly might have been rather difficult to solve becomes easy to solve. The Algol compiler was absolutely full of wonderful tricks INTERVIEWER: How did you arrive at Microsoft? SIMONYI: Once I made a decision to leave Xerox, I put out some feelers. I had lunch with Bob Metcalfe, the Ethernet guy and chairman and founder of 3Com, who left Xerox a couple of years bcforc mc. Hc madc up a list of pcoplc I should scc. Numbcr onc on thc list was Bill Gatcs. I dont http://programmersatwork.wordpress.com remember who number two was because i never got that far NTERVIEWER: Is programming a tcchniquc or a skill? SIMONYI: What is programming? People argue about it all the time. Some people call it a science some people call it an art, some people call it a shill or trade. I think it has aspects of all three. we like to pretend that it has a lot of art in it, but wc know it has a lot of scicncc Kids learn mathematics in school, and when they finish high school they think of mathematics as addition and multiplication, and maybe even algebra and calculus. But there is an incredible supporting scicncc behind arithmetic, cvcn for a simplc opcration like addition There is also a tremendous amount of supporting science behind computer programming. For example, the mathematical proof for Godels Theorem is very long and complex, but if you use some of Turings theorems from computer science, the proof is trivial. Information theory and the other aspects of computer science have a great effect on mathematics, and vice versa There is a lot of science in programming, and at the same time it is somewhat of a trade. In fact, for many people, programming is a complex skill, very much like toolmaking, that requires a lot of care. I think if you take a healthy dose of all three [science, art, and skilll, you can get some very exciting results INTERVIEWER: What is thc part of programming that you consider to bc art? Is it dcsigning thc user interface SIMONYI: I think that there is certainly an aesthetic aspect to programs, not only in the design, but cvcn in the appearance, of thc uscr interfacc. Thc artistic limitations of programmers comc to light when you look at some ugly screens. Otherwise, computer programming is an arl just as high energy physics is an art INTERVIEWER: is the aesthetic aspect related only to how the user perceives the program or would it also be apparent to another programmer who looks at the program and sees how it is written? SIMONYI: Absolutely, absolutely. I think the aesthetics of the listings and of the computers themselves have always fascinated me The Russian machine, for example, looked like a science-fiction computer because each flip-flop [the on-off device that stores one bit of information in the machine had a little orange, old- Fashioned gas discharge light. Hundreds of orange lights Flickered behind glass doors and cabinets Thc wholc lifc of thc machinc pulsed right in front of your cycs The Danish computer was a beautiful piece of furniture. It was about the size of an antique wardrobe closet. The front of the computer had three leak doors. I once saw an American executive look at it in disbelief bccausc it was paneled in tcak It cven had a Danish-modern console. the http://programmersatwork.wordpress.com whole machine had the intriguing smell of teak. The Bcrkclcy computcr was quitc largc, about 20 fcct long, 6 fcct high, and 2 fcct dccp. It was hidden in a concrete vault that was painted completely black. The computer was a little like the monolith in the film 200/ because of the way it was placed inside the vault with spotlights shining on it NTERVIEWER: What do you perceive as aestheticaly beautiful or pleasing in either the listing or the structure of the algorithms when you look at a particular program? SIMONYI: I think thc listing gives the samc sort of plcasurc that you gct from a clcan homc. You can just tell with a glance if things are messy--if garbage and unwashed dishes are lying about--or if things are really clean. It may not mean much. Just because a house is clean, it might still be a den of iniquity! But it is an important first impression and it does say something about the program. I'll bet you that from ten feet away I can tell if a program is bad. I might not guarantee that it is good, but if it looks bad from ten feet, I can guarantee you that it wasn't written with care. And if it wasnt written with care, it's probably not beautiful in the logical sense But suppose it looks good. You then pick deeper. To understand the structure of a program is much, much harder. Somc pcoplc havc diffcrent opinions about what makcs thc structurc bcautiful. Thcrc are purists who think only structured programming with certain very simple constructions, used in a very strict mathematical fashion, is beautiful. That was a very reasonable reaction to the situation before the sixties when programmers were unaware of the notion of structuring But to me, programs can be beautiful even if they do not follow those concepls, if they have other redeeming features It's like comparing modern poetry with classical poetry. I think classical poetry is great and you can appreciate it. But you can't limit your appreciation to just classical poetry. It also doesn, t mean that if you put random words on paper and call it poetry, there will be beauty. But if a codc has somc redeeming qualities, I don't think it nccds to bc structured in a mathcmatical sense to be beautiful INTERVIEWER: Is it possible that someone could read some of your source code and say, "Charles simonyi wrote this codc"? SIMONYI: Oh yes, no doubt. Whether I wrote it myself or not might be fairly difficult to tell, but one thing is for sure: You could look at it and know if it was written in my organization or under my influcncc. This is bccausc all the codc that i have written since about 1972 has bccn written with certain naming conventions that are popularly called Hungarian. You can immediately recognize ll the code that has been written under my influence, including Microsoft Word and multiplan, bravo, and many others written with those conventions INTERVIEWER: What do you mean by"Hungarian"naming conventions? SIMONYI: It's called"Hungarian"as a joke. You know they say, " That's Greek to me, " meaning thcy don't undcrstand it, so it might as wcll be writtcn in Grcck. Hungarian"is a twist on that http://programmersatwork.wordpress.com phrase because these naming conventions are actually supposed to make the code more readable The joke is that the program looks so unreadable, it might as well be written in Hungarian. But it's a set ofconvenLions that controls the naming ofall quantilies in the program If you were to break up a program, put it into a grinder, and then sort the pieces, you would find that the bulk of the program is in names. If you just write, "apples t oranges, "the name"apples"is six characters, the operation"is one character. the name " oranges" is seven characters, for a lotal or fourteen charactcrs. Only onc charactcr, the plus sign, had to do with thc opcration. So to mc it seemed logical that to make an impact or improve things, I would try to improve the greatest bulk- and that was the names. Hungarian"is a way of almost automatically creating a name from the properties of the named quantity. Very similar to the idea of calling people Taylor if they were tailors and Smyth if they were blacksmiths So if you have a structure with certain properties, instead of giving it some arbitrary name and then having everybody learn the association between the name and the properties, you use the properties themselves as the nane. This method has a lot of advantages. First, it's very easy lo create a name-- as you think of the properties, you write them down and immediately have the name. Second, it is very understandable, because as you read something you learn a lot about the properties from the name. As these properties get more and more numerous, it becomes difficult to describe them concisely. So Hungarian"introduces some abbreviated notation to encode the properties in a short space. of course this is a complete jumble lo the uninitiated, and that's the joke Some people think if they can read each of the words in a code, then the program is readable. In fact, readability is in that sense unimportant. Nobody takes a listing, goes up to a podium, and reads a program out loud. It's comprehension that counts. The fact that you can just read the words and pronounce them is useless. When people see a listing in " "they find these words difficult to pronounce, so they might think it isnt readable. But in fact, it's easier to comprehend and asier to communicate because of the association between the name and the properties. People who use Hungarian to program usually continue to use it even after they leave my organization I have a lot of splinter organizations at Apple Computer, 3 Com, and many other companies INTERVIEWER: Let's talk about the process you go through in creating programs. Is there a process you can apply to all programs? SIMONYI: Sure. If we're talking strictly about programming, then let's assume I already know hat I want to do. If I don't, then there is some aspect of the process that is common to all problem solving: What am I trying to do? What is the goal? For example, I want a text editor to be menu driven, fast, have a spelling checker, and so on. I need to know the end product before true programming begins. Sometimes the choice of the goal dcpcnds on what I alrcady havc in my bag of tricks. In thc casc of Bravo, the program was guided by the algorithms. Butler Lampson described a couple of interesting algorithms, so we attempted to write the editor around those algorithms to exploit them. Also, J Moore--he is the Moore of the Boyer-Moore string search algorithm - had some very interesting algorithms for editing http://programmersatwork.wordpress.com documents. Again, we said, "Hey, let's do an editor that includes the Moore editing algorithm, the Lampson screen-update algorithms, and a couple of caches. Once I have a good feel about the goals, then Lhe real programming begins. I shin gears and sit down, dose the door, and say, " Now I want to program NTERVIEWER: When you shift gears and actually start programming, what do you do first? SIMONYI: The first step in programming is imagining. Just making it crystal clear in my mind what is going to happen. In this initial stage, I use paper and pencil. I just doodle, I don t write code I might draw a few boxes or a few arrows, but it,'s just mostly doodles, because the real picture is in my mind I like to imagine the structures that are being maintained, the structures that represent the reality i want to codc Once I have the structure fairly firm and clear in my mind, then I write the code. I sit down at my terminal--or with a piece of paper in the old days--and write it. It's fairly easy. I just write the different transformations and i know what the results should be. the code for the most part writes itself, but it's the data structures I maintain that are the key they come first and i keep them in my mind throughout the entire process INTERVIEWER: Is that the biggest step SIMONYI: Absolutely, that is the biggest step: The knowledge of the best algorithms is the science, and the imagining of the structure is the art. The details of algorithms, writing efficient lincs of codc to implcment transformations on thosc structurcs, is thc tradc aspect of programming Technically, this is called maintaining the invariances in the structures. Writing the code to maintain invariances is a relatively simple progression of craftsmanship but it requires a lot of care and discipline INTERVIEWER: Do you ever get tired of programming? SIMONY: Yes INTERVIEWER: When you write a program, is it a painful process or a pleasurable process? SIMONYI: It's a mixture. I think it's foolish to pretend that every minute is a pleasure. Like the athletes say, "If it doesn hurt, you're not working hard enough Aller twenty years, I don 't get the feeling of novelty that i did after I had been programming for one or two years. I still get it sometimes, but not as often, no way INTERVIEWER: Do you have a routine? Do you program every day or do you walk away from the problcm for a whilc and then stay up for a wcck to work on it? SIMONYI: I don t have a chance to program every day. i don't have to walk away from a problem, because people interrupt me. My routine is that I program at night and I am interrupted during the http://programmersatwork.wordpress.com NTERVIEWER: Do you come to the office to work at night or do you work at home? SIMONYI: I work hcrc at thc officc. I live vcry nearby, so it's casy. It's like going to a diffcrent room in your home. Instead of going to the den to program, I come to the office. It's just two minutes awa INTERVIEWER: How do you supervise the programmers who work for you? Do you find that you are doing more supervising now than programming? SIMONYI: I do both, and right now I'm doing more programming. In the Bravo days, the supervision of the programmers was vcry, vcry dircct. Oncc I actually wrote an incredibly dctailcd work order, which was called a metaprogram. It was almost like a program, except written in a very, very high-level language. We hired two bushy-tailed guys from Stanford as " experimental subjects. "They wrote the program exactly the way I wanted it to be written and we accomplished two things. First, it was easier for me to work in this incredibly high-level language, essentially programming these people. Second, they really learned the program much better than if I had finished it and given them the listing and said, " Study this program They learned it because they wrote it. See, everybody could claim that they wrote the program. I wrote the program and they wrote the program. That was really great I think the best way to supervise is by personal example and by frequent code reviews. We try to do code reviews all the time INTERVIEWER: If you havc morc than onc programmer working on a program, docs it dcvclop nore quickly? SIMONYI: Not necessarily. The actual amount of code produced per person is smaller, the more pcoplc thcrc arc writing the program. Conscqucntly, thc total codc produccd is grcatcr for a whilc and then it may actually decrease With two people, you might get 50 percent more code per unit of time By the way, thc cfficicncy of thc codc also dccrcascs with an incrcasc in thc numbcr of pcoplc working on the program. The most efficient programs are written by a single person. The only problem is, it might take forever to write, and that is unacceptable So you have two or three, five or ten, or hundreds of people working on a project INTERVIEWER: Can you predict how long it will take to write a program? SIMONYI: We have great difficulty in predicting the time it will take to write a program. There are valid reasons why this is so. It doesn't mean we shouldn t try our best to predict, because there are reasons why a prediction might be useful, just like when a weather prediction has economic as well as other benefits Really good programs will live forever and take forever to write, at least as long as the hardware exists, and maybe even longer. Certainly, Bravo lived for as long as the Alto existed. The people http://programmersatwork.wordpress.com 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论