Thursday, 21 March 2013

What's the difference between a programming language, a scripting language, and a markup language?

This is easier to explain in sequence from simple to complex (although it isn't a hierarchy), and the categories aren't as fixed as they appear. The best definitions can be found in the venerable Portland Pattern Repository, but this is my understanding of the terms, as far as it is possible to define them within the last few decades of computer history:

Markup languages
Crucially, these languages (HTML, CSS, XML...) have no logic, and are for marking up text or data in logical groupings (e.g. XML), and/or for setting and storing (typically) property:value pairs (e.g. CSS).

Scripting languages
There is no firm category of 'scripting' languages, but the term is often used to indicate (as nathanator11 states) easy-to-use languages at a higher level than compiled languages like C. Perl, Python, Ruby and PHP are often called scripting languages, partly because the write-compile-run cycle is shortened to write-run, as the language runs via an interpreter that turns the English-like code you write into something the computer can understand. However, boundaries are blurred because some languages can be both interpreted and compiled. Yet, from the programmer's point of view, the main difference is the lack of a need to explicitly compile, and hence the development process is (theoretically) shortened. Some 'scripting' languages can be modified while they are actually running. Although there may appear to be a long route from (say) Unix shell scripting to (say) Perl and Ruby, there's a continuum of features that each borrows of inherits from its predecessors. Another crucial factor in scripting languages is that they do not (usually) deal with such things as memory allocation.

In the days before high level languages (further removed from the 'metal' or lower-level code of the machine itself) there wasmachine code and assembly language; following the advent of high-level languagesscripting was a term often reserved for enhancements to existing functionality, or to carry out small repetitive tasks, yet it still covered a wide range - Visual Basic, Javascript and Logo have all been called 'scripting' languages.

Programming or compiled languages
Typically, the category 'programming languages' covers all languages that contain logic to control whatever you want to do with a computer, so 'scripting' languages are also included. However, some of these languages need to be compiled (see above) from the code you type in to machine instructions, so the need to compile a language puts it in a separate category. As a rough guide, any language that can directly manipulate the lower-level workings of the computer is most likely not going to be called a scripting language.

No comments:

Post a Comment