十年內(nèi)自學(xué)編程

Teach Yourself Programming in Ten Years

Peter Norvig

Why is everyone in such a rush?

Walk into any bookstore, and you'll see how to?Teach Yourself Java in 24 Hours?alongside endless variations offering to teach C, SQL, Ruby, Algorithms, and so on in a few days or hours. The Amazon advanced search for [title: teach, yourself, hours, since: 2000?and found 512 such books. Of the top ten, nine are programming books (the other is about bookkeeping). Similar results come from replacing "teach yourself" with "learn" or "hours" with "days."

The conclusion is that either people are in a big rush to learn about programming, or that programming is somehow fabulously easier to learn than anything else. Felleisen?et al.?give a nod to this trend in their book?How to Design Programs, when they say "Bad programming is easy.?Idiots?can learn it in?21 days, even if they are?dummies." The Abtruse Goose comic also had?their take.

Let's analyze what a title like?Teach Yourself C++ in 24 Hours?could mean:

Teach Yourself:?In 24 hours you won't have time to write several significant programs, and learn from your successes and failures with them. You won't have time to work with an experienced programmer and understand what it is like to live in a C++ environment. In short, you won't have time to learn much. So the book can only be talking about a superficial familiarity, not a deep understanding. As Alexander Pope said, a little learning is a dangerous thing.

C++:?In 24 hours you might be able to learn some of the syntax of C++ (if you already know another language), but you couldn't learn much about how to use the language. In short, if you were, say, a Basic programmer, you could learn to write programs in the style of Basic using C++ syntax, but you couldn't learn what C++ is actually good (and bad) for. So what's the point??Alan Perlis?once said: "A language that doesn't affect the way you think about programming, is not worth knowing". One possible point is that you have to learn a tiny bit of C++ (or more likely, something like JavaScript or Processing) because you need to interface with an existing tool to accomplish a specific task. But then you're not learning how to program; you're learning to accomplish that task.

in 24 Hours:?Unfortunately, this is not enough, as the next section shows.

Teach Yourself Programming in Ten Years

Researchers (Bloom (1985),?Bryan & Harter (1899),?Hayes (1989),?Simmon & Chase (1973)) have shown it takes about ten years to develop expertise in any of a wide variety of areas, including chess playing, music composition, telegraph operation, painting, piano playing, swimming, tennis, and research in neuropsychology and topology. The key is?deliberative?practice: not just doing it again and again, but challenging yourself with a task that is just beyond your current ability, trying it, analyzing your performance while and after doing it, and correcting any mistakes. Then repeat. And repeat again. There appear to be no real shortcuts: even Mozart, who was a musical prodigy at age 4, took 13 more years before he began to produce world-class music. In another genre, the Beatles seemed to burst onto the scene with a string of #1 hits and an appearance on the Ed Sullivan show in 1964. But they had been playing small clubs in Liverpool and Hamburg since 1957, and while they had mass appeal early on, their first great critical success,?Sgt. Peppers, was released in 1967.

Malcolm Gladwell?has popularized the idea, although he concentrates on 10,000 hours, not 10 years. Henri Cartier-Bresson (1908-2004) had another metric: "Your first 10,000 photographs are your worst." (He didn't anticipate that with digital cameras, some people can reach that mark in a week.) True expertise may take a lifetime: Samuel Johnson (1709-1784) said "Excellence in any department can be attained only by the labor of a lifetime; it is not to be purchased at a lesser price." And Chaucer (1340-1400) complained "the lyf so short, the craft so long to lerne." Hippocrates (c. 400BC) is known for the excerpt "ars longa, vita brevis", which is part of the longer quotation "Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile", which in English renders as "Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgment difficult."?Of course, no single number can be the final answer: it doesn't seem reasonable to assume that all skills (e.g., programming, chess playing, checkers playing, and music playing) could all require exactly the same amount of time to master, nor that all people will take exactly the same amount of time. As Prof.?K. Anders Ericsson?puts it, "In most domains it's remarkable how much time even the most talented individuals need in order to reach the highest levels of performance. The 10,000 hour number just gives you a sense that we're talking years of 10 to 20 hours a week which those who some people would argue are the most innately talented individuals still need to get to the highest level."

So You Want to be a Programmer

Here's my recipe for programming success:

Get?interested?in programming, and do some because it is fun. Make sure that it keeps being enough fun so that you will be willing to put in your ten years/10,000 hours.

Program. The best kind of learning is?learning by doing. To put it more technically, "the maximal level of performance for individuals in a given domain is not attained automatically as a function of extended experience, but the level of performance can be increased even by highly experienced individuals as a result of deliberate efforts to improve."?(p. 366)?and "the most effective learning requires a well-defined task with an appropriate difficulty level for the particular individual, informative feedback, and opportunities for repetition and corrections of errors." (p. 20-21) The book?Cognition in Practice: Mind, Mathematics, and Culture in Everyday Life?is an interesting reference for this viewpoint.

Talk with?other programmers; read other programs. This is more important than any book or training course.

If you want, put in four years at a?college?(or more at a graduate school). This will give you access to some jobs that require credentials, and it will give you a deeper understanding of the field, but if you don't enjoy school, you can (with some dedication) get similar experience on your own or on the job. In any case, book learning alone won't be enough. "Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter" says Eric Raymond, author of?The New Hacker's Dictionary. One of the best programmers I ever hired had only a High School degree; he's produced a lot of?great?software, has his own?news group, and made enough in stock options to buy his own?nightclub.

Work on?projects with?other programmers. Be the best programmer on some projects; be the worst on some others. When you're the best, you get to test your abilities to lead a project, and to inspire others with your vision. When you're the worst, you learn what the masters do, and you learn what they don't like to do (because they make you do it for them).

Work on?projects?after?other programmers. Understand a program written by someone else. See what it takes to understand and fix it when the original programmers are not around. Think about how to design your programs to make it easier for those who will maintain them after you.

Learn at least a half dozen?programming languages. Include one language that emphasizes class abstractions (like Java or C++), one that emphasizes functional abstraction (like Lisp or ML or Haskell), one that supports syntactic abstraction (like Lisp), one that supports declarative specifications (like Prolog or C++ templates), and one that emphasizes parallelism (like Clojure or Go).

Remember that there is a "computer" in "computer science". Know how long it takes your computer to execute an instruction, fetch a word from memory (with and without a cache miss), read consecutive words from disk, and seek to a new location on disk. (Answers here.)

Get involved in a language?standardization?effort. It could be the ANSI C++ committee, or it could be deciding if your local coding style will have 2 or 4 space indentation levels. Either way, you learn about what other people like in a language, how deeply they feel so, and perhaps even a little about why they feel so.

Have the good sense to?get off?the language standardization effort as quickly as possible.

With all that in mind, its questionable how far you can get just by book learning. Before my first child was born, I read all the?How To?books, and still felt like a clueless novice. 30 Months later, when my second child was due, did I go back to the books for a refresher? No. Instead, I relied on my personal experience, which turned out to be far more useful and reassuring to me than the thousands of pages written by experts.

Fred Brooks, in his essay?No Silver Bullet?identified a three-part plan for finding great software designers:

Systematically identify top designers as early as possible.

Assign a career mentor to be responsible for the development of the prospect and carefully keep a career file.

Provide opportunities for growing designers to interact and stimulate each other.

This assumes that some people already have the qualities necessary for being a great designer; the job is to properly coax them along.?Alan Perlis?put it more succinctly: "Everyone can be taught to sculpt: Michelangelo would have had to be taught how not to. So it is with the great programmers". Perlis is saying that the greats have some internal quality that transcends their training. But where does the quality come from? Is it innate? Or do they develop it through diligence? As Auguste Gusteau (the fictional chef in?Ratatouille) puts it, "anyone can cook, but only the fearless can be great." I think of it more as willingness to devote a large portion of one's life to deliberative practice. But maybe?fearless?is a way to summarize that. Or, as Gusteau's critic, Anton Ego, says: "Not everyone can become a great artist, but a great artist can come from anywhere."

So go ahead and buy that Java/Ruby/Javascript/PHP book; you'll probably get some use out of it. But you won't change your life, or your real overall expertise as a programmer in 24 hours or 21 days. How about working hard to continually improve over 24 months? Well, now you're starting to get somewhere...

References

Bloom, Benjamin (ed.)?Developing Talent in Young People, Ballantine, 1985.

Brooks, Fred,?No Silver Bullets, IEEE Computer, vol. 20, no. 4, 1987, p. 10-19.

Bryan, W.L. & Harter, N. "Studies on the telegraphic language: The acquisition of a hierarchy of habits.?Psychology Review, 1899, 8, 345-375

Hayes, John R.,?Complete Problem Solver?Lawrence Erlbaum, 1989.

Chase, William G. & Simon, Herbert A.?"Perception in Chess"?Cognitive Psychology, 1973, 4, 55-81.

Lave, Jean,?Cognition in Practice: Mind, Mathematics, and Culture in Everyday Life, Cambridge University Press, 1988.

AnswersApproximate timing for various operations on a typical PC:

execute typical instruction1/1,000,000,000 sec = 1 nanosec

fetch from L1 cache memory0.5 nanosec

branch misprediction5 nanosec

fetch from L2 cache memory7 nanosec

Mutex lock/unlock25 nanosec

fetch from main memory100 nanosec

send 2K bytes over 1Gbps network20,000 nanosec

read 1MB sequentially from memory250,000 nanosec

fetch from new disk location (seek)8,000,000 nanosec

read 1MB sequentially from disk20,000,000 nanosec

send packet US to Europe and back150 milliseconds = 150,000,000 nanosec

Appendix: Language Choice

Several people have asked what programming language they should learn first. There is no one answer, but consider these points:

Use your friends. When asked "what operating system should I use, Windows, Unix, or Mac?", my answer is usually: "use whatever your friends use." The advantage you get from learning from your friends will offset any intrinsic difference between OS, or between programming languages. Also consider your future friends: the community of programmers that you will be a part of if you continue. Does your chosen language have a large growing community or a small dying one? Are there books, web sites, and online forums to get answers from? Do you like the people in those forums?

Keep it simple. Programming languages such as C++ and Java are designed for professional development by large teams of experienced programmers who are concerned about the run-time efficiency of their code. As a result, these languages have complicated parts designed for these circumstances. You're concerned with learning to program. You don't need that complication. You want a language that was designed to be easy to learn and remember by a single new programmer.

Play.?Which way would you rather learn to play the piano: the normal, interactive way, in which you hear each note as soon as you hit a key, or "batch" mode, in which you only hear the notes after you finish a whole song? Clearly, interactive mode makes learning easier for the piano, and also for programming. Insist on a language with an interactive mode and use it.

Given these criteria, my recommendations for a first programming language would be?Python?or?Scheme. Another choice is Javascript, not because it is perfectly well-designed for beginners, but because there are so many online tutorials for it, such as?Khan Academy's tutorial. But your circumstances may vary, and there are other good choices. If your age is a single-digit, you might prefer?Alice?or?Squeak?or?Blockly?(older learners might also enjoy these). The important thing is that you choose and get started.

Appendix: Books and Other Resources

Several people have asked what books and web pages they should learn from. I repeat that "book learning alone won't be enough" but I can recommend the following:

Scheme:?Structure and Interpretation of Computer Programs (Abelson & Sussman)?is probably the best introduction to computer science, and it does teach programming as a way of understanding the computer science. You can see?online videos of lectures?on this book, as well as the?complete text online. The book is challenging and will weed out some people who perhaps could be successful with another approach.

Scheme:?How to Design Programs (Felleisen?et al.)?is one of the best books on how to actually design programs in an elegant and functional way.

Python:?Python Programming: An Intro to CS (Zelle)?is a good introduction using Python.

Python:?Several online?tutorials?are available at?Python.org.

Oz:?Concepts, Techniques, and Models of Computer Programming (Van Roy & Haridi)?is seen by some as the modern-day successor to Abelson & Sussman. It is a tour through the big ideas of programming, covering a wider range than Abelson & Sussman while being perhaps easier to read and follow. It uses a language, Oz, that is not widely known but serves as a basis for learning other languages. <

Notes

T. Capey points out that the?Complete Problem Solver?page on Amazon now has the "Teach Yourself Bengali in 21 days" and "Teach Yourself Grammar and Style" books under the "Customers who shopped for this item also shopped for these items" section. I guess that a large portion of the people who look at that book are coming from this page. Thanks to Ross Cohen for help with Hippocrates.



十年內(nèi)自學(xué)編程

Peter?Norvig

為什么大家都這么著急?

走進任何一家書店吸耿,你都會知道怎么做在24小時內(nèi)自學(xué)Java除此之外抠蚣,在幾天或幾個小時內(nèi)嚣潜,還提供了各種各樣的課程巷懈,包括C語言、\nSQL览绿、Ruby策严、算法等等。\n亞馬遜高級搜索[標題:教挟裂,教自己享钞,小時,從2000年開始找到了512本這樣的書。在前十本書中栗竖,九本是編程書(另一本是關(guān)于簿記的)暑脆。把“自學(xué)”換成“學(xué)習(xí)”,把“小時”換成“天”狐肢,也會得到類似的結(jié)果添吗。

結(jié)論是,要么人們急于學(xué)習(xí)編程份名,要么編程比其他任何東西都要容易得多碟联。\?nFelleisenet?al.在他們的書中肯定了這一趨勢如何設(shè)計程序,當他們說“糟糕的編程很容易僵腺±鸱酰”白癡可以在21天,即使他們是假人Abtruse?Goose漫畫也有他們把.

讓我們來分析一下標題是什么樣子的在24小時內(nèi)自學(xué)c++可能意味著:

自學(xué):在24小時內(nèi)辰如,你將沒有時間去寫一些不重要的程序普监,并從你的成功和失敗中學(xué)習(xí)。你不會有時間和一個有經(jīng)驗的程序員一起工作琉兜,也不會了解在c++環(huán)境中生活是什么樣子的凯正。簡而言之,你沒有時間學(xué)太多東西豌蟋。所以這本書只能講一些膚淺的熟悉廊散,而不是深刻的理解。正如亞歷山大·蒲柏所說梧疲,無知是件危險的事允睹。

C++:在24小時內(nèi),您可能能夠?qū)W習(xí)一些\nC++的語法(如果您已經(jīng)掌握了另一種語言)幌氮,但您無法學(xué)到很多關(guān)于如何使用這門語言的知識擂找。簡而言之,如果你是一個\nBasic程序員浩销,你可以學(xué)習(xí)用c++語法編寫\nBasic風(fēng)格的程序,但是你不能學(xué)習(xí)c++到底有什么好處(和壞處)听哭。那么重點是什么呢?Alan\nPerlis曾經(jīng)說過:“一門不影響你對編程的思考方式的語言不值得你去了解”慢洋。一個可能的觀點是,你必須學(xué)習(xí)一點c++(或者更有可能是像JavaScript或處理之類的東西)陆盘,因為你需要與現(xiàn)有的工具接口來完成特定的任務(wù)普筹。但你并不是在學(xué)習(xí)如何編程;你正在學(xué)習(xí)如何完成這項任務(wù)。

24小時內(nèi):不幸的是隘马,這還不夠太防,如下一個\nsection所示。

十年內(nèi)自學(xué)編程

研究人員(Bloom\n(1985),Bryan?&?Harter?(1899),Hayes\n(1989),Simmon?&?Chase?(1973))已經(jīng)表明酸员,它花了大約10年的時間在各種各樣的領(lǐng)域發(fā)展專長蜒车,包括下棋讳嘱、作曲、電報操作酿愧、繪畫沥潭、鋼琴演奏、游泳嬉挡、網(wǎng)球钝鸽,以及神經(jīng)心理學(xué)和拓撲學(xué)的研究。關(guān)鍵是協(xié)商練習(xí):不只是一遍又一遍地重復(fù)庞钢,而是挑戰(zhàn)自己拔恰,做一個超出你能力范圍的任務(wù),嘗試基括,在做的時候和之后分析自己的表現(xiàn)颜懊,改正任何錯誤。然后重復(fù)阱穗。并再次重復(fù)饭冬。似乎沒有捷徑可走:即使是4歲的音樂天才莫扎特,也花了13年多的時間才開始創(chuàng)作出世界級的音樂作品揪阶。在另一種音樂流派中昌抠,甲殼蟲樂隊似乎以一系列熱門單曲和1964年在埃德·沙利文秀上亮相而突然走紅。但自1957年以來鲁僚,他們就一直在利物浦和漢堡的小俱樂部演出炊苫,雖然他們早期有廣泛的吸引力,但他們的第一個巨大成功冰沙,中士辣椒該片于1967年上映侨艾。

馬爾科姆\?nGladwell普及了這個想法,盡管他專注于1萬個小時拓挥,而不是10年唠梨。nHenri?Cartier-Bresson(1908-2004)有另一個衡量標準:“你的前一萬張照片是你最差的〗钠。”(他沒有預(yù)料到有了數(shù)碼相機当叭,有些人可以在一周內(nèi)達到那個目標)真正的專業(yè)知識可能需要一生的時間:塞繆爾·約翰遜(1709-1784)說過:“任何部門的卓越成就都只能用一生的努力獲得;不能以低價購買。喬叟(1340-1400)抱怨道:“路太短盖灸,到勒內(nèi)的航船太長蚁鳖。”希波克拉底(約公元前400年)以摘錄“ars?longa,?nvita?brevis”而著名赁炎,這是較長的引文“ars?longa,?vita?nbrevis醉箕,偶爾praeceps,?experimentum?pericullosum,?iudicium\ndifficile”的一部分,英文翻譯為“生命短暫,工藝短暫讥裤,機會稍息放棒,實驗不穩(wěn)定,判斷困難”坞琴。當然,沒有一個數(shù)字可以最終答案:這似乎不合理而\假設(shè)所有技能(如編程,國際象棋,跳棋,和播放音樂)\?ncould都需要完全相同的時間掌握,也不是所有人\?nwill采取完全相同的時間哨查。作為\?nProf。k·安德斯·愛立信他說:“在大多數(shù)領(lǐng)域剧辐,即使是最有才華的人也需要多少時間才能達到最高水平寒亥,這是值得注意的。一萬個小時這個數(shù)字只是給你一種感覺荧关,我們在談?wù)摰氖敲恐?0到20個小時的時間溉奕,那些被一些人認為是最有天賦的人仍然需要達到最高水平∪唐。”

所以你想成為一名程序員

以下是我的編程成功秘訣:

得到感興趣在編程方面加勤,做一些因為它是有趣的。確保你的簡歷始終充滿樂趣同波,你才愿意為此投入十年或一萬個小時鳄梅。

程序。最好的學(xué)習(xí)方式是學(xué)習(xí)\?nby做未檩。更專業(yè)地說戴尸,“在給定領(lǐng)域中,個人的最大績效水平不是作為擴展經(jīng)驗的功能自動獲得的冤狡,但即使是經(jīng)驗豐富的個人孙蒙,也可以通過故意努力提高績效水平”ǎ”(p.?366)而最有效的學(xué)習(xí)需要一個明確定義的任務(wù)挎峦,對特定的人來說有不合適的難度,有豐富的反饋合瓢,有機會重復(fù)和改正錯誤坦胶。(20-21頁)這本書?實踐中的認知:日常生活中的心智、數(shù)學(xué)和文化是這個觀點的一個有趣的參考晴楔。

跟其他程序員;閱讀其他程序迁央。這比任何書本或培訓(xùn)課程都重要。

如果你愿意滥崩,在a讀四年大學(xué)(或者在研究生院更多)。這會讓你獲得一些需要證書的工作讹语,也會讓你對這個領(lǐng)域有更深的了解钙皮。但是如果你不喜歡學(xué)校,你可以(通過一些努力)在自己或工作中獲得類似的經(jīng)驗。在任何情況下短条,光靠書本知識是不夠的导匣。“計算機科學(xué)教育不能使任何人成為專業(yè)程序員茸时,就像學(xué)習(xí)畫筆和顏料不能使某人成為專業(yè)畫家一樣”贡定,《計算機科學(xué)教育不能使任何人成為專業(yè)程序員,就像學(xué)習(xí)畫筆和顏料不能使某人成為專業(yè)畫家一樣”新\?nHacker的字典可都。我雇傭過的最好的程序員之一不僅只有高中學(xué)歷;他制作了很多偉大的?軟件缓待,有自己的新聞集團他通過股票期權(quán)賺了足夠的錢買了自己的股票夜總會.

工作項目其他程序員。在某些項目上做最好的程序員;在另一些人身上做最差的渠牲。當你是最優(yōu)秀的旋炒,你可以測試自己領(lǐng)導(dǎo)一個項目的能力,以及用你的愿景激勵他人的能力签杈。當你是最差的時候瘫镇,你會了解到老板做什么,也會了解到他們不喜歡做什么(因為他們讓你幫他們做)答姥。

工作項目后其他程序員铣除。理解別人寫的程序。當最初的程序員不在時鹦付,看看如何理解和修復(fù)它尚粘。考慮一下如何設(shè)計你的程序睁壁,讓那些在你之后維護它們的人更容易維護它們背苦。

至少學(xué)半打編程語言。包括一種強調(diào)類抽象的nlanguage(如Java或c++)潘明,一種強調(diào)函數(shù)抽象的nlanguage(如Lisp或ML或Haskell)行剂,一種支持語法抽象的nlanguage(如Lisp),一種支持聲明性規(guī)范的nlanguage(如Prolog或c++?ntemplates)钳降,以及一種不強調(diào)并行性的nlanguage(如Clojure或Go)厚宰。

記住有個\"電腦在“計算機科學(xué)”中。知道你的計算機執(zhí)行一條指令遂填,從內(nèi)存中讀取一個\nword(有或沒有緩存丟失)铲觉,從磁盤中讀取連續(xù)的單詞,并尋找到磁盤上的新位置需要多長時間吓坚。(答案在這里撵幽。)

參與一門語言標準化努力。它可能是ANSI?c++委員會礁击,或者它可能決定你的本地編碼風(fēng)格將有2或4個空格縮進級別盐杂。無論哪種方式逗载,你都能了解到別人在語言中喜歡什么,他們對這種語言的感覺有多深链烈,甚至可能了解一點他們?yōu)槭裁磿羞@種感覺厉斟。

有什么好見識嗎下車盡可能快地進行語言標準化工作。

考慮到所有這些强衡,僅僅通過書本學(xué)習(xí)你能走多遠是值得懷疑的擦秽。在我第一個孩子出生之前,我讀了所有的而如何\讀書時漩勤,仍然覺得自己像個無知的新手感挥。30個月后,當我的第二個孩子即將出生時锯七,我是否又去看書復(fù)習(xí)了一遍?不链快。相反,我依靠的是我的個人經(jīng)驗眉尸,這比專家寫的成千上萬頁書對我更有用域蜗,更讓我安心。

弗雷德·布魯克斯在他的文章中寫道沒有銀彈找出優(yōu)秀的軟件設(shè)計師的三部分計劃:

盡早系統(tǒng)地確定頂級設(shè)計師噪猾。

指派一名職業(yè)導(dǎo)師霉祸,負責(zé)發(fā)展未來客戶,并仔細保存職業(yè)檔案袱蜡。

為成長中的設(shè)計師提供相互交流和激勵的機會丝蹭。

這假設(shè)有些人已經(jīng)具備成為偉大設(shè)計師所必需的品質(zhì);要做的就是好好地哄著它們。Alan\nPerlis更簡潔地說:“每個人都可以被教雕刻:米開朗基羅必須被教如何不去雕刻坪蚁”即”偉大的程序員也是如此。佩利斯說偉人的內(nèi)在品質(zhì)超出了他們所受的訓(xùn)練敏晤。但質(zhì)量差從何而來?是天生的嗎?還是通過勤奮而發(fā)展?奧古斯特·古斯特(Auguste?Gusteau)飾演燉菜書中寫道贱田,“人人都會做飯,但只有無所畏懼的人才能變得偉大嘴脾∧写荩”我認為這更像是一種愿意把生命中很大一部分時間用于深思熟慮的修行。但也許無所畏懼的可以這樣總結(jié)译打『耐兀或者,正如食神的評論家南東?伊戈所說:“不是每個人都能成為偉大的藝術(shù)家奏司,但偉大的藝術(shù)家可能來自任何地方乔询。”

所以去買一本Java/Ruby/Javascript/PHP的書吧;你可能不會有什么用的韵洋。但在24小時或21天內(nèi)哥谷,你不會改變你的生活岸夯,或你真正的程序員專長。在過去的24個月里努力工作们妥,不斷提高,怎么樣?嗯勉吻,現(xiàn)在你開始有進展了……

參考文獻

布魯姆,本杰明(ed)监婶。培養(yǎng)年輕人的才能百齡壇,1985。

布魯克斯,弗雷德,沒有銀子彈齿桃,?IEEE計算機惑惶,第20卷,第1期短纵,第2頁带污。1987年4月,第10-19頁香到。

電報語言的研究:習(xí)慣層次的習(xí)得鱼冀。心理學(xué)的評估,\n1899,?8,?345-375

海斯、約翰·R悠就。完全解決問題Lawrence?Erlbaum,?1989.

蔡斯千绪,威廉G.?&西蒙,赫伯特A.梗脾。\“象棋\感知”?認知心理學(xué),?1973,?4,?55-81.

Lave,?Jean,實踐中的認知:日常生活中的心智荸型、數(shù)學(xué)和文化,劍橋大學(xué)出版社炸茧,1988年瑞妇。

答案

在典型PC上的各種操作的近似時間:

執(zhí)行典型的指令1/?10億秒=?1納秒

從L1緩存中獲取數(shù)據(jù)0.5?nanosec

轉(zhuǎn)移的錯誤預(yù)測5?nanosec

從L2緩存內(nèi)存中獲取7?nanosec

Mutex?lock/unlock25?nanosec

從主存中獲取100?nanosec

通過1Gbps網(wǎng)絡(luò)發(fā)送2K字節(jié)20000年nanosec

從內(nèi)存中順序讀取1MB250000年nanosec

從新的磁盤位置獲取(尋道)8000000年nanosec

從磁盤順序讀取1MB20000000年nanosec

把包裹寄到歐洲再寄回來150毫秒=?1.5億納秒

附錄:語言選擇

有幾個人問他們應(yīng)該首先學(xué)習(xí)哪種編程語言。沒有唯一的答案梭冠,但考慮以下幾點:

使用你的朋友辕狰。當被問到“我應(yīng)該使用什么操作系統(tǒng),Windows,?Unix還是Mac?”妈嘹,我的回答通常是:“隨便你朋友用什么就用什么柳琢。”你從你的朋友那里獲得的優(yōu)勢將抵消OS之間或編程語言之間的內(nèi)在差異润脸。也要考慮你未來的朋友:如果你繼續(xù)下去柬脸,你將成為其中一員的程序員社區(qū)。你所選擇的語言是否有一個正在成長的大社區(qū)毙驯,還是一個正在消亡的小社區(qū)?有書籍倒堕、網(wǎng)站和在線論壇可以得到答案嗎?你喜歡那些論壇里的人嗎?

保持簡單。像c++和Java這樣的編程語言是專為專業(yè)開發(fā)而設(shè)計的爆价,這些專業(yè)開發(fā)團隊都是有經(jīng)驗的程序員垦巴,他們關(guān)心代碼的運行時效率媳搪。因此,這些語言都有為這些環(huán)境設(shè)計的復(fù)雜部分骤宣。你關(guān)心的是學(xué)習(xí)編程秦爆。你不需要那么復(fù)雜。你想要一種語言被設(shè)計成一個新程序員容易學(xué)習(xí)和記憶憔披。

玩了等限。你更愿意用哪種方式來學(xué)習(xí)彈鋼琴:不正常的、互動的方式芬膝,你一鍵就能聽到每個音符望门,還是“批量”模式,你只有在聽完一整首歌之后才能聽到這些音符?顯然锰霜,交互模式可以讓學(xué)習(xí)鋼琴更容易筹误,也可以讓編程更容易。堅持使用具有交互模式的語言并使用它癣缅。

考慮到這些標準厨剪,我對第一種編程語言的建議是Python或計劃。另一個選擇是Javascript所灸,不是因為它為初學(xué)者設(shè)計得很好丽惶,而是因為有很多關(guān)于它的在線教程,比如可汗學(xué)院的教程但是你的情況可能會有所不同爬立,還有其他好的選擇钾唬。如果你的\位是個位數(shù),你可能更喜歡愛麗絲或吱吱聲或塊(年長的學(xué)習(xí)者可能也喜歡這些)侠驯。重要的是你的選擇和開始抡秆。

附錄:書籍和其他資源

有幾個人問他們應(yīng)該從哪些書和網(wǎng)頁中學(xué)習(xí)。我重申吟策,“單靠書本學(xué)習(xí)是不夠的”儒士,但我可以推薦以下內(nèi)容:

方案:?計算機程序的結(jié)構(gòu)與解釋(Abelson?&?Sussman)可能是最好的計算機科學(xué)入門,它把編程作為一種理解計算機科學(xué)的方式來教檩坚。\?nYou可以看到在線講座視頻在這本書着撩,以及完成文本在線。這本書具有挑戰(zhàn)性匾委,它將淘汰掉一些用另一種方法可能不會成功的人拖叙。

方案:?如何設(shè)計程序(Felleisenet?al.)是關(guān)于如何以優(yōu)雅和實用的方式設(shè)計程序的最好的書之一。

Python:?Python編程:\nAn?CS入門(Zelle)是使用Python的一個很好的入門赂乐。

Python:幾個\?nonline教程可用在

Python.org.

奧茲:?計算機編程的概念薯鳍、技術(shù)和模型(Van?Roy?&?Haridi)被一些人視為Abelson?&?Sussman的現(xiàn)代接班人。nIt是一個大的編程思想的旅行挨措,涵蓋比Abelson?&?Sussman更廣泛的范圍挖滤,同時可能更容易閱讀和理解崩溪。它使用一種語言休里,Oz赢乓,不廣為人知疙渣,但作為學(xué)習(xí)其他語言的基礎(chǔ)干跛。

筆記

T.?Capey指出完成\?n問題解決者亞馬遜的網(wǎng)頁上現(xiàn)在有“21天自學(xué)孟加拉語”和“自學(xué)語法和風(fēng)格”兩本書,買過這款產(chǎn)品的顧客也買過這些產(chǎn)品贰锁。我猜大部分看那本書的人都來自這一頁各谚。感謝羅斯·科恩對希波克拉底的幫助玫坛。

翻譯

Thanks?to?the\nfollowing?authors岭参,\ntranslations?of?\nthis?page?are\navailable?in:

阿拉伯語

(Mohamed?A.?Yahya)

保加利亞

(Boyko?Bantchev)

中國人

(Xiaogang?Guo)

克羅地亞

(Tvrtko?Bedekovic)

Esperanto

(Federico?Gobbo)

法國

(Etienne?Beauchesne)

德國

(Stefan?Ram)

希伯來語

(Eric麥凱恩)

Hindi

(Vikash?Tiwari)

匈牙利

(Marton?Mestyan)

印尼

(Tridjito?Santoso)

意大利

(Fabio?Z.?Tessitore)

日本

(yomoyomo)

韓國\?n(約翰·黃)

波斯

(Mehdi?Asgari)

波蘭的

(Kuba?Nowak)

葡萄牙語

(Augusto?Radtke)

羅馬尼亞

(?tefan?Laz?r)

俄羅斯

(Konstantin?Ptitsyn)

塞爾維亞

(Lazar?Kovacevic)

西班牙語

(Carlos?Rueda)

斯洛伐克語

(Jan?Waclawek)

土耳其

(?a??l?Ulu?ahin)

Ukranian

(Oleksii?Molchanovskyi)

Peter?Norvig(Copyright?2001—2014)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市尝艘,隨后出現(xiàn)的幾起案子演侯,更是在濱河造成了極大的恐慌,老刑警劉巖背亥,帶你破解...
    沈念sama閱讀 217,907評論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件秒际,死亡現(xiàn)場離奇詭異,居然都是意外死亡狡汉,警方通過查閱死者的電腦和手機娄徊,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,987評論 3 395
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來盾戴,“玉大人寄锐,你說我怎么就攤上這事〖夥龋” “怎么了橄仆?”我有些...
    開封第一講書人閱讀 164,298評論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長衅斩。 經(jīng)常有香客問我盆顾,道長,這世上最難降的妖魔是什么畏梆? 我笑而不...
    開封第一講書人閱讀 58,586評論 1 293
  • 正文 為了忘掉前任您宪,我火速辦了婚禮,結(jié)果婚禮上奠涌,老公的妹妹穿的比我還像新娘宪巨。我一直安慰自己,他們只是感情好铣猩,可當我...
    茶點故事閱讀 67,633評論 6 392
  • 文/花漫 我一把揭開白布揖铜。 她就那樣靜靜地躺著,像睡著了一般达皿。 火紅的嫁衣襯著肌膚如雪天吓。 梳的紋絲不亂的頭發(fā)上贿肩,一...
    開封第一講書人閱讀 51,488評論 1 302
  • 那天,我揣著相機與錄音龄寞,去河邊找鬼汰规。 笑死,一個胖子當著我的面吹牛物邑,可吹牛的內(nèi)容都是我干的溜哮。 我是一名探鬼主播,決...
    沈念sama閱讀 40,275評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼色解,長吁一口氣:“原來是場噩夢啊……” “哼茂嗓!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起科阎,我...
    開封第一講書人閱讀 39,176評論 0 276
  • 序言:老撾萬榮一對情侶失蹤述吸,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后锣笨,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體蝌矛,經(jīng)...
    沈念sama閱讀 45,619評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,819評論 3 336
  • 正文 我和宋清朗相戀三年错英,在試婚紗的時候發(fā)現(xiàn)自己被綠了入撒。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,932評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡椭岩,死狀恐怖茅逮,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情簿煌,我是刑警寧澤氮唯,帶...
    沈念sama閱讀 35,655評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站姨伟,受9級特大地震影響惩琉,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜夺荒,卻給世界環(huán)境...
    茶點故事閱讀 41,265評論 3 329
  • 文/蒙蒙 一瞒渠、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧技扼,春花似錦伍玖、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,871評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春椰棘,著一層夾襖步出監(jiān)牢的瞬間纺棺,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,994評論 1 269
  • 我被黑心中介騙來泰國打工邪狞, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留祷蝌,地道東北人。 一個月前我還...
    沈念sama閱讀 48,095評論 3 370
  • 正文 我出身青樓帆卓,卻偏偏與公主長得像巨朦,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子剑令,可洞房花燭夜當晚...
    茶點故事閱讀 44,884評論 2 354

推薦閱讀更多精彩內(nèi)容