We have all heard of computer languages. They define how we develop software, providing a programmer with a way of communicating with the computer. SQL, a popular database querying tool, literally stands for "structured query language." Most would agree that Python and C# are computer languages. But is SQL actually a language? What about XML, XPath, or XQuery? How about SAS or R? It seems naive to claim these are all languages, as their functions range from queries, data storage and organization, to front-end and back-end development, and even statistical analysis. In fact, R is based on C, so does R still count as its own language? In this post we tackle what makes a computer language a language.
Computer languages, like spoken languages, are ways of communicating ideas. When two people who know the same language converse, they are able to understand each other because they both know the rules that define how to translate sounds into meaning and meaning into sounds. However, if two humans speak different languages, then a mediator or translator is required for communication. Consequently then, a computer language has to be a compromise. Translating a language such as English directly into a machine language is very difficult for a machine. Similarly, "speaking" a machine language is cumbersome for a human.
A computer language is one that a human can speak reasonably well, and that a computer can translate into a language that it understands. In terms of definition, a computer language can usually be described by its two main components, syntax and schema, or semantics and structure. Programming languages, on the other hand, are used to create programs to control the behavior of a machine or to express algorithms with the use of both inherent attributes.
Because computers perform so many types of tasks, different languages have been developed that specialize in these tasks. As such, all of the languages listed in the introduction ARE technically computer languages. Take SQL for instance. As the SQL acronym declares, it is a language. It offers looping, logic statements, variables, and so on. Similarly, XML stands for Extensible Markup Language. XML defines a schema and a set of rules for encoding documents in a format that is both human-readable and machine-readable. XPath and XQuery as extensions of XML, can also be defined as computer languages. SAS and R are optimized for statistical analysis and thus have their own unique syntax and schema specialized for this task.
Any structured textual format which can be processed computationally can be called a language. A language does not do anything as such, for instance English and Spanish do not do anything, but some software might process input in the language and do something based on it. Programming languages are a subset of computer languages. While there is no formal definition of programming language, a programming language usually can perform a task on a machine.
Since you made it this far, enjoy this comic by the incomparable Randall Munroe of xkcd that lampoons the idiosyncrasies of various computer languages:
A language is a programming language if it can perform a task on a machine. Additionally, as said above, it should be defined with syntax and semantics. The goal of programming languages is to make tasks easier, or be specialized for use in a particular area. For example, languages such as C are good for operating systems and small embedded computers. Other languages like PHP specialize in creating web pages. Python is a general purpose language that specializes in being easy-to-use. SQL is a programming languages that is closer to human language, but still is specialized for data storage and querying. SAS and R are languages optimized for statistical analysis. XML is a computer language, as it is defined by a set structure and semantics, and can be used to define programming languages, like XSLT.
All of these languages are high-level programming languages. High-level programming languages, while simple when compared to our own human languages, are more complex than the languages the computer actually understands, briefly discussed before as machine languages. Each different type of CPU and processor has its own unique machine language. Regardless of what higher level language you end up utilizing, eventually you need to convert the resulting program into a machine language, via a compiler or interpreter, so that the computer can actually understand it. Here, the compiler or interpreter act as a translator or English-Spanish dictionary to extend the metaphor above.
Lying between machine languages and high-level languages are languages called assembly languages. Assembly languages are similar to machine languages, but they are much easier to program in because they allow a programmer to substitute names for numbers. Machine languages consist of numbers only. Lying above high-level languages are languages called fourth-generation languages, or 4GLs. 4GLs are far removed from machine languages and represent the type of computer languages closest to human speech, syntax, and structure.
The question of which language is the best consumes a lot of time and energy among computer professionals. Every language has its own strengths and weaknesses, as they usually are optimized for specific tasks. The choice of which language to use depends on the type of computer the program is to run on, what sort of program it is, and the experience of the programmer, just to name a few.
What is your favorite computer or programming language? Let us know in the comments below!
The SaberSmart Team