Jump to content

Talk:Programming language/Purpose

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Purpose

[edit]

Like other specialized languages, such as musical notation and mathematical formulae, programming languages facilitate the communication of a specific kind of knowledge, namely, computation, or the task of organizing and manipulating information. For example, a programming language might enable its user to express the following:

Programming languages differ from most other forms of human expression in that they force the author to write instructions with exceeding precision and completeness. In a natural language, or even mathematical notation, authors can be ambiguous and make errors. For example, consider natural language:

  • Speakers can leave things out, because humans excel at "filling in the gaps" of a partial statement. If someone says: "Going to the store," the listener might use the context to fill in the missing words: "I am going to the store on the corner."
  • Speakers can make grammatical errors, because humans excel at compensating for minor errors in language. If someone says, "I am going to the store am the corner," the listener can usually tell that "am" is meant to be "on".

But because computers are not yet able to "fill in the gaps", and have only limited ability to "understand" human language, every part of every computation must be expressed explicitly and exactly in a programming language. Each phrase in a program corresponds unambiguously to its literal meaning, and no more. If the author of a program states that the program should perform an incorrect step, the program's meaning will include that incorrect step. If the author omits a necessary step, the program's meaning will not include that step. Therefore, in order to write a "correct" program, the author must be correct in every detail.

In return for this exacting discipline, programming languages reward the user with a unique power: Many programming languages are executable by an electronic computer. In other words, tasks expressed in most programming languages can be performed autonomously by a computer, without human intervention. Therefore, programming languages have enormous practical utility; they enable the construction of programs that automatically perform tasks. The entire information technology industry is built around the construction and use of programs. A programming language implementation is a system that enables a computer to execute a program written in a programming language. Programming languages can be implemented by an interpreter, a compiler, or some combination of both.

Many languages have been designed from scratch, altered to meet new needs, combined with other languages, and fallen into disuse. Although there have been attempts to make one "universal" computer language that serves all purposes, all of them have failed. The need for diverse computer languages arises from the diversity of contexts in which languages are used:

  • Programs range from tiny scripts written by individual hobbyists to huge systems written by hundreds of programmers.
  • Programmers range in expertise from novices, who need simplicity above all else, to experts, who may be comfortable with considerable complexity.
  • Programs may need to extract the right amount of performance on platforms ranging from tiny microcontrollers to supercomputers.
  • Programs may be written at one time, to reflect some exacting constraints, and then not changed for generations, until these constraints change, or they may undergo nearly constant modification.
  • Finally, programmers may simply differ in their tastes or habits: they may be accustomed to discussing problems and expressing them in a particular language. Languages like COBOL and 'C' proved surprisingly persistent despite some deficiencies often observed. Some credit William H. Gates III's devotion to BASIC for keeping that language alive to this day.

One common trend in the development of programming languages has been to add more ability to solve problems on a higher level. The earliest programming languages were tied very closely to the underlying hardware of the computer. As new programming languages have developed, features have been added that let programmers express ideas that are more removed from simple translation into underlying hardware instructions. Because programmers are less tied to the needs of the computer, their programs can do more computing with less effort from the programmer. This lets them write programs in ways that are closer to the way they think about the problems they are solving. It also lets them write more programs in the same amount of time. And because the programs are written more like how they think about the problems, it is easier for a new programmer to understand a program that was written by somebody else.