Jump to content

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

cjapes's Photo
Posted Jan 28 2011 03:23 PM
13471 Views

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

2 Replies

-1
  nathanator11's Photo
Posted Jan 28 2011 04:21 PM

A 'scripting' language is traditionally used to describe a language that gives a computer a simple, relatively-linear set of instructions to follow. Traditionally, scripts are used more for automation than for software development.

A programming language is usually used to describe something a little heavier than a scripting language: something that one could develop a complex piece of software in, with an interface, multiple pieces of code, etc.
However, modern scripting languages can be very powerful. Some can have interfaces, talk to code libraries, and interact with databases. Some are even object-oriented.

A 'markup' language is not for giving a computer tasks to do, but rather telling it how to interpret something. The markup provides the structure of the data. For example, XML tells the computer the hierarchy of the data it contains.

Hope this helps.
--Nate
+ 1
  DaveEveritt's Photo
Posted Jan 31 2011 03:51 AM

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 was machine code and assembly language; following the advent of high-level languages, scripting 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.

But there will always be exceptions to any category...