Peter Norvig: Learn to Program for 10 Years

Original author: Peter Norvig
  • Transfer
Translator’s note: This article was published by Peter Norvig in 2001. According to the 2001 version, a translation into Russian was made . In 2014, the article was updated, but the translation was not updated. Therefore, I completed my translation of the article on its current version of 2014. I believe that the article has not lost its relevance, although it is somewhat outdated. If you find any errors in the translation, write in a personal.

Where is everyone in such a hurry?


Go to any bookstore and you will immediately see a book on how to learn Java in 24 hours, as well as endless options, how to learn C, SQL, Ruby, algorithms, and so on in a few days or hours. Amazon Advanced Search [ title: teach, yourself, hours, since: 2000 ] provides a list of 512 books. Of the top ten, nine are books on programming (only one is about accounting). You will get the same results by replacing "teach yourself" with "learn" and "hours" with "days".

Hence the conclusion: either people are in a great hurry to learn programming, or to learn programming in some fabulous way more easily than anything else. Felleisen et al. mentioned it in their book How to Design Programswhen they wrote “Bad programming is easier than ever. Idiots can learn this in 21 days, even if they are full of nerds. ” The website of the Abtruse Goose commissions also covered this topic ( here is the link ).

Let's see what the title of the book Teach Yourself C ++ in 24 Hours can mean :

  • Teach Yourself: In 24 hours you will not have time to write some significant programs and draw conclusions from your successes and failures. You will not have time to work with an experienced programmer and understand what the ideology of C ++ is. In short, in this short time you will learn not so much. So the book means only superficial acquaintance, but not deep understanding. As Alexander Pope said: “ Little knowledge is a dangerous thing .”
  • C ++: In 24 hours you are quite able to learn something from the syntax of C ++ (if you already know another programming language), but you don’t learn much about how to use this language. In short, if you say, a Basic programmer, you learn how to write Basic-style programs using the C ++ syntax, but you won’t understand for what tasks C ++ is really good (or bad). Well, what do you say? As Alan Perlis said : " If the language does not change your ideas about programming, it is useless to study it ." Well, except that you need to learn a little C ++ to figure out how to use some kind of library for a specific task. But in this case we are not talking about learning programming in a language; you are simply learning how to do a specific task.
  • in 24 Hours: Unfortunately, as I will show below, this time is not enough.

Learn programming for 10 years


Research ( Bloom (1985) , Bryan & Harter (1899) , Hayes (1989) , Simmon & Chase (1973) ) showed that it takes about ten years to master skills in a particular area, for example, playing chess, musical composition, telegraphing, drawing, playing the piano, swimming, tennis, neurophysiology and topology. The secret is thoughtfulpractice: not just a mechanical repetition, but search for tasks that are higher than your current level, solving them, analyzing your actions during their solution and after they are solved, correcting mistakes made. And again. And again. There is no shorter way: even Mozart, who became a wonderful child as a child at the age of 4, took 13 years before he began to create world-class music. The Beatles in 1964 broke into the scene with a bunch of hits and performed on Ed Sullivan's show. But before that, they had played in the small clubs of Liverpool and Hamburg since 1957. And despite their worldwide fame among fans, their first success among music critics came with the release of "Sergeant Pepper" in 1967.

This idea was popularized by Malcolm Gladwellin his book, although there he talks about 10,000 hours, not 10 years. The famous photographer Henri Cartier-Bresson (1908-2004) expressed this idea in the following way: “ The first 10,000 photographs will be your worst ” (He didn’t even realize that with a digital camera some people manage to achieve this figure in a week). Real experience comes with life: Samuel Johnson (1709-1784) wrote “ Experience in any field can only be gained by the work of a lifetime; there is no lower price ”; Chaucer (1340-1400) complained: " It is so little to live, to learn so much ." Hippocrates (400 BC) is known for saying “ life is short, science is vast", Which completely sounds like this:" Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile ", and in Russian translation" Life is short, science is extensive, the case of unsteady, experience is deceptive, judgment is difficult. " Of course, no number can be an exact answer: there is no reason to assume that all skills (programming, playing chess, checkers, musical instrument) require exactly the same time to master them, as well as what different people need exactly the same time. As Professor K. Anders Ericsson said : “In most areas it is simply amazing how long it takes even the most talented to master the mastery. The number of “10,000 hours” just helps you understand that we are talking about several years of hard work 10-20 hours a week to achieve the highest level even for the most naturally gifted since the birth of talents

So you want to be a programmer.


Here is my recipe for success in programming:

  • Get interested in programming and create something just for fun. It should be so interesting for you that it would not be a pity to spend the next 10 years / 10,000 hours on it.
  • Program . The best training is practice . In technical terms, “the maximum level of productivity for an individual in a particular area is not automatically achieved with experience; on the contrary, the level of productivity can be increased even by the most experienced individuals through a conscious desire for improvement” ( p. 366 ) and “for the most effective training is good the task at hand with the appropriate level of complexity for a specific individual, an understandable assessment of its implementation and the possibilities for its repeated implementation and correction of admitted errors Ibok ”(pp.20-21) The book Cognition in Practice: Mind, Mathematics, and Culture in Everyday Life is a very instructive reading on this thought.
  • Talk to other programmers; read other programs. This is much more important than any book or training course.
  • If you want, devote four years to study at the university (or in graduate school). This will give you access to jobs that require confirmed titles and titles. But if you do not like studying, you can (with a certain zeal) get all the same knowledge on your own or directly at work. In any case, studying only from books is not enough. “ Education in the field of computer science will not make anyone an expert in programming, just as the study of brushes and colorful pigments cannot be made a master artist, ” writes Eric Raymond , author of The New Hacker's Dictionary. The best programmer I have ever had to hire, only had a secondary school course behind my back, and he createdexcellent programs , moderated the mailing list of their own fans , and earned enough on options to buy their own nightclub .
  • Work on projects with other programmers. Be the best programmer in some projects; be the worst in others. When you are the best, you test your abilities to lead a project and inspire others with your vision. When you are the worst, you learn from the masters, what they do, and what they don't like to do (this is what they charge you to do).
  • Work on projects after other programmers. Try to understand a program written by someone else. Look at what it takes to understand the code and fix it when there are no programmers around who have written it. Think about how to design your programs so that they are easier to support those who will work with them after you.
  • Learn at least half a dozen programming languages . Choose to learn one language that is based on class abstractions (for example, Java or C ++), one for supporting functional abstractions (for example, Lisp or ML or Haskell), one for supporting syntax abstraction (for example, Lisp), one declarative language (for example , Prolog or C ++ - templates), and one - emphasizing concurrency (for example, Clojure or Go).
  • Do not forget that in the phrase "computer science" is the word computer . Remember how long it takes your computer to execute a single instruction, to read a machine word from memory (with and without a cache miss), to read a sequence of machine words from a disk, to search for a record on disk ( Answers here )
  • Take part in the standardization of a programming language. This can be an ANSI C ++ commission, or a meeting on your team, where you determine how many spaces you set for indentation in the code - 2 or 4. In any case, you will find out what other people like about the language, how deep their feeling is, and you may also find out from what it went.
  • Be able to understand when it is time to leave the committee on the standardization of language as soon as possible.

With all this, just reading books will give you not so much. Before the birth of my first child, I read all the books about caring for babies, and still did not understand at all what to do. 30 months later, when my second child was preparing to be born, do you think I looked in the books to refresh my memory? Not. I relied on my own experience, which turned out to be much more useful and better than thousands of pages written by experts.

Fred Brooks in his article " Silver Bullet Does Not Exist " outlined three steps in the search for excellent programmers:

  1. Systematically identify the best programmers as early as possible.
  2. Assign a programmer to a mentor who will develop talent and carefully monitor his career.
  3. Encourage your growing talents to communicate with each other in every way so that they can exchange ideas.

It turns out that some people already have qualities that allow them to become great programmers; you just need to direct them along the right path. Alan Perlis ( Alan Perlis ) expressed it more concisely: “ Everyone can be taught to make sculptures; Michelangelo would have to learn how not to sculpt them. Similarly with great programmers . ” Perlis wanted to say that the great ones have some inner qualities that are not acquired through training. But where do these qualities come from? Is it innate? Or are they worked out by zeal? As Aguste Gusto said (the character of the cartoon Ratatouille ) " anyone can cook, but only the fearless can become great ." I believe that in our case we are talking about a burning desire to devote a b ofMost of your life focused on self-taught programming. But there may be a fearless more appropriate word. Or, as Anton His said (critic of Agusta Gusto): “ not everyone can become a great artist, but a great artist can appear from everywhere ”.

So, go ahead and buy a book on Java / Ruby / JavaScript / PHP; perhaps you will get some benefit from it. But you will not be able to change your life and will not become an expert in programming in 24 hours or 21 days. How about spending 24 months of hard work to continuously master the subject? Now we are already having a serious conversation ...

Literature


  • 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, WL & Harter, N. "Study of the 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, Cambridge University Press, 1988.

Answers


Estimated time to perform various operations in a typical PC:
performing typical instructions1 / 1,000,000,000 sec = 1 nanosec
reading from L1 cache0.5 nanosec
prediction error5 nanosec
read from L2 cache7 nanosec
capture / release of mutex25 nanosec
read from main memory100 nanosec
send 2K over 1Gbps network20,000 nanosec
reading 1MB sequentially from memory250,000 nanosec
read from a search disk8,000,000 nanosec
reading 1MB sequentially from disk20,000,000 nanosec
sending a data packet from the USA to Europe and back150 milliseconds = 150,000,000 nanosec


Application: language selection


Some readers asked me the question of which programming language they should learn first. There is no single answer to this question, but consider the following points:

  • Refer to your friends . When people ask me, “which operating system should I choose — Windows, UNIX or Mac?”, I answer: “use the one your friends use”. What you learn from your friends will override any internal differences between operating systems or programming languages. Also consider your future friends: the community of programmers, of which you will become a part, if you continue your training. Does your chosen language have a large growing community or does it become small and dying out? Do a large number of books, websites and forums where you can get answers? Do you like people hanging out at these forums?
  • Start simple . C ++ and Java programming languages ​​are designed for the professional work of large teams of experienced programmers who are most concerned with the efficiency of their code execution. As a result, these programming languages ​​have complex structures to solve such problems. You also need to learn how to program. You do not need extra complexity. You need a language that is specifically designed to be easy to learn and remember.
  • Play How would you like to learn to play the piano: in the usual interactive way when you hear each note as soon as you press a key, or in “batch mode” —when you hear the whole melody only after you press all the notes of the song on the keys? Of course, the interactive method is much easier, as is programming. Select the language in which there is an interactive mode of operation, and play it.

Given all these criteria, I recommend Python or Scheme as the first programming language. Or JavaScript, but not because it is ideal for beginners, but because there are a lot of textbooks on this language, for example, in the Academy of Caen . But your particular case may be special, so there are many other languages ​​to choose from. If you are under ten years old, you might like Alice or Squeak or Blockly (older students might also like them). The main thing is to make a choice and start learning.

Appendix: Books and other resources


They ask me which books and websites are best for learning. I repeat once again: “reading books alone is not enough,” but I would recommend the following:


Also popular now: