Paul Graham: The programming language of the Dream

Source: Internet
Author: User

My friend once told a famous operating-system expert that he wanted to design a really good programming language. The expert replied that it was a waste of time, that good language would not necessarily be accepted by the market, and probably no one would use it, because the language's popularity did not depend on it. At least that was the case with the language that the expert designed.

So what is the reason for the popularity of language? Is the popular language really worth the pop? Is it necessary to try to design a better language? If necessary, how can this be done?

To find the answers to these questions, I think we can look at hackers and understand what language they use. Programming languages are designed to meet the needs of hackers, and this language can become a qualified programming language only when hackers like a language, rather than being used as a "referent semantics" (denotational semantics) or compiler design.

the secret of popular

Yes, most people choose a programming language, not because the language has any unique characteristics, but because they hear other people use it. But I think the popularity of external factors for programming languages is not as powerful as it might seem. I think the problem is that the hacker's view is not the same as most language designers for what is a good programming language.

The hacker's view is actually more important than the language designer. Programming language is not a mathematical theorem, but a tool that is designed for ease of use. Therefore, the design language must be designed to take into account human strengths and weaknesses, like the design of shoes must conform to the human foot type. If the shoes are uncomfortable to wear, no matter how beautiful they are, how much like a piece of artwork, you can only treat it as a pair of bad shoes.

Most programmers may not be able to tell the difference between language and quality. However, this does not mean that good programming languages will be buried, and expert hackers can recognize them at a glance and use them. Although they are small in number, it is this little group of people who have written all the good software of mankind. They have a huge influence, what language they use, and other programmers tend to follow it. To be honest, this influence is more of a command, and for other programmers, expert hackers are like their own bosses or mentors who say which language works well and that they will follow suit.

The expert hacker's view is not the only factor that determines the popularity of a language, and some old software (FORTRAN and COBOL) and overwhelming advertising (ADA and Java) can also play a role. However, I think that in the long run, expert Hacker's view is the most important factor. As long as there is an initial user to reach the "critical amount" (Critical mass) and long enough, a language may reach its proper prevalence. And the popularity itself will make this excellent language more excellent, and further increase the difference between it and mediocre language, because the user's feedback will always lead to language improvement. You can think about how much of all the popular programming languages have changed since the birth. Perl and Fortran are extreme examples, but even Lisp has changed a lot.

So, even if the language itself is not good enough to promote the popularity of the popular, I think the prevalence alone will certainly make this language better, only popular will keep it good. The highest realm of programming language has been developing. Although the core function of language is like the depths of the sea, there are few changes, but the function library and development environment is like the surface of the sea, has been surging.

Of course, hackers have to know the language before they can use it. How are they going to know? Is from other hackers there. So anyway, a bunch of hackers had to use the language at first, and then other people would know about it. I do not know the "group" of the minimum number of how many hackers are counted to reach the "critical quantity"? If let me guess, I will say 20 people. If a language has 20 independent users, it means that 20 people decide to use the language in their own right, and I think it shows that the language really has merit.

It's not easy to reach this step. I wouldn't be surprised if the number of users from 0 to 20 was more difficult than 20 to 1000. The best way to develop the first 20 users might be to use a Trojan horse: you get people to use an application they need, and the program happens to be developed in a new language.

external factors

We have to admit that there really is an external factor that can affect the prevalence of language. A language must be the scripting language of a popular computer system (scripting language) before it becomes popular. Fortran and COBOL are the scripting languages of the early IBM mainframe. c is the UNIX scripting language, and later Perl and Python are the same. Tcl is the scripting language of TK, Visual Basic is the scripting language of Windows, (some form of) Lisp is the scripting language of Emacs, PHP is the scripting language of the Web server, and Java and JavaScript are the scripting languages of the browser.

Programming languages do not exist in a vacuum. "Programming" is actually a transitive verb, a hacker is generally programmed for a system, in reality, programming languages are always associated with their attached systems. So, if you want to design a popular programming language, you can't simply design the language itself, but you must also find a system attached to it, and the system must be popular. Unless you only want to replace the existing scripting language of that system with the language of your own design.

One consequence of this situation is that the language cannot be judged by the merits and demerits of a language itself. Another result is that it can become a programming language only if one language is the scripting language of a system. If you are surprised and feel unfair, then I will tell you not to fuss. It's like everyone thinks that if a programming language has only grammatical rules and no good implementations (implementation), then it can't be a complete programming language. These are normal and reasonable things, and programming languages should be.

Of course, programming languages need to be a good implementation, and this implementation must be free. Commercial companies are willing to pay for the software, but hackers, as individuals, will not be willing to do so, and you want to make a language a success, precisely the need to attract hackers.

The programming language also needs to have a book that introduces it. This book should be not thick, the writing is fluent, and contains a lot of good examples. The C programming language (C programming Language), written by Brain Konihan and Dennis Ritchie, is an example of this. For now, I can probably add that one of these books must be published by the O ' Reilly Company. This is becoming a precondition for the ability to attract hackers.

The programming language should also have online documentation. In fact, online documentation can be written as a book, but it is not yet a substitute for physical books. Physical books are not outdated, they are easy to read, and Publishers ' review of book content is a useful quality assurance mechanism (albeit imperfect). Bookstores are one of the most important places for programmers to discover and learn a new language.

Concise

Assuming your language has been able to meet the three criteria above-a free implementation, a book, and a computer system attached to the language-what else does it take to make hackers like your language?

A feature of hacker appreciation is simplicity. Hackers are lazy people who, like mathematicians and modernist architects, hate anything or anything that is redundant. There is a joke that before hackers write a program, at least in the heart of the language to calculate the minimum amount of typing, and then choose to use the language. This joke is in fact the same as the real situation. Even if this is really a joke, the language designer must take it seriously and design the language according to its requirements.

The most important aspect of brevity is to make the language more abstract. In order to achieve this, you must first design a high-level language, and then design it more abstractly the better. Language designers should always look at the code and ask themselves if they can use fewer grammatical units to express it. If you have a way to make many different programs more brief, it probably means that you have discovered a new and useful abstraction.

Do not think for the sake of the user is to let them use like English as long and the words of the grammar. This is not the right approach, and COBOL is notorious for this problem.

If you let the hacker sum up like this:

Add x to Y giving Z

Rather than written:

Z=x+y

Then you are insulting the hacker's IQ, or your own iniquity.

Brevity is the grasp of static type languages. No one wants to write a whole bunch of statements on the head of the program without considering other factors. As long as the computer can infer its own things, should let the computer to infer. For example, "Hello World" should be a very simple program, but in the Java language to write a lot of things, which in itself almost can explain the Java language design problems.

Individual grammatical units should also be brief. Perl and Common Lisp are two different extremes in this regard. Perl's syntax is short, causing its code to be too crowded to understand, and the name of the Common Lisp built-in operator is ridiculously long. Common Lisp designers may feel that the text editor will help users automatically fill in the long name of the operator. But the cost of doing so not only increases the amount of typing, but also increases the difficulty of reading the code and takes up more space on the display.

Programmability (hackability)

For hackers, when choosing a programming language, there is another factor more important than brevity, which is that the language must be able to help itself do what it wants to do. In the history of programming languages, the steps to prevent programmers from making "wrong" moves are staggering. It's a risky move for language designers to be self-righteous, and how do they know what the programmer should do? I think that language designers should assume that their target users are a genius, and that they do all sorts of things they can't predict, rather than assume that the target user is a clumsy fool and that someone needs protection to protect themselves. If the user is really a fool, no matter how you protect him, he will still foot. You might be able to stop him from referencing a variable in another module, but you can't prevent him from writing a messy program to solve a completely wrong problem day and night.

Good programmers often want to do something that is both dangerous and annoying. The so-called "irritating", I mean, is that they break through the external semantic layers that designers provide to users, trying to control some of the high-level abstractions of the internal interface of the language. For example, hackers like to crack, and cracking means deep inside, to speculate on the intentions of the original designer.

You should open your mind and welcome this speculation. For the people who make the tools, there will always be users who use your tools in a way that violates your intentions. This is especially true if you are creating a system with a highly integrated programming language. Many hackers will change your grammar model in a way that you never dreamed of. My advice is to let them do it, and to make it easier for them to expose as much of their internal language as possible to their presence.

In fact, hackers do not completely subvert your tools, in a large program, he may only be one or two places for language transformation. However, it is not important to change the number of places, it is important that he can change the language. This may not only help solve some of the special problems, but also make the hacker feel very fun. The pleasure of hacking the language is like the pleasure of a surgeon fiddling with a patient's guts, or a teenager's feeling of squeezing a pimple with his hand. At least for boys, some types of damage are very stimulating. Maxim Magazine, a young male reader, publishes a special feature every year, half of it is beautiful photos, and the other half is live photos of all kinds of serious accidents. The magazine is very clear about what its readers want to see.

A really good programming language should be both neat and messy. "Neat" means the design is very clear, the kernel is composed of a few operators, these operators are easy to understand, each has a very complete independent use. "Chaos" means that it allows hackers to use them in their own way. This is the case with the C language, as was the case with the early Lisp language. The real hacker language is always a little bit indulgent and unruly personality.

The good programming language has the function, should make the speech must be called "The software Engineering" the person to feel very dissatisfied, frequently shakes the head. In stark contrast to the hacker's language is the language, like Pascal, which is a well-organized model, perfect for teaching, but otherwise useless.

Disposable Programs

In order to attract hackers, a programming language must be adept at accomplishing the various tasks that hackers want to accomplish. This means that it must be well suited to developing a one-time program. This may surprise many people.

A one-off procedure is a program that is written in a very short period of time to accomplish some very simple temporary task. For example, programs that automate certain system administration tasks, or programs that automatically generate test data (for a simulation task), and programs that convert data between different formats. Surprisingly, one-off programs are often not really used only once, as many of the makeshift buildings built by American universities during World War II became permanent buildings later. Many disposable programs later became formal programs, with formal functions and external users.

I have a hunch that this is how the best big programs are developed, rather than being designed as a big project from the start, like the Hoover Dam. It was a horrible thing to make a big project from scratch. When people take over a giant project, it's easy to get it down. Finally, either the project is deadlocked, or a small, poorly performing thing is done. You want to build a downtown, but only make a shopping mall; you want to build a Rome, but only one Brasilia; you want to invent C, but you only develop ADA.

Another way to develop a large program is to start with a one-time program and then improve it continuously. This method of comparison is not daunting, the process of continuous development gradually progress. In general, using this method to develop a program, what programming language to start with, will be used until the end, because unless there is external political intervention, programmers rarely change the programming language halfway. So, we have a seemingly contradictory conclusion: if you want to design a programming language suitable for developing large projects, you have to make this language suitable for the development of one-off programs, because large projects evolve from a one-off program.

Perl is a stark example. It is not only designed to develop a one-time program, but it is very much like a one-time program. The original Perl was just a collection of several tools for generating tables. Then the programmer used it to write a one-time program, and when those programs grew, Perl developed into a formal programming language. By Perl 5, this language is suitable for developing important programs, but it has been popular before.

What language is suitable for writing a one-time program? First, it must be very easy to equip. A one-time program is a program that you only want to write in an hour, so it shouldn't take a lot of hours to install and configure, preferably installed on your computer. It has to be used. C language can be used, because it is part of the operating system, Perl can be used to use, because it is a system management tool, the operating system has been installed by default.

It is easy to equip not only to be easy to install or to install, but also to easily interact with users. A language with a command-line interface that can be fed in real time is interactive, and those languages that must be compiled first are not interactive. The popular programming language should be the former, with good interactivity and the ability to get running results quickly.

Another feature of a one-time program is simplicity. For hackers, this is always attractive. This is even more important if you consider that you are only going to spend one hours on this program at most.

Paul Graham: The programming language of the Dream

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.