This is a brief explanation of which is which and why.
A computer language is any language a computer understands. Its purpose is to provide a way to tell the computer to do something. If you want a bold font, you have to tell the computer to use a bold font. If you want an image of a certain size on the left, you have to tell the computer to insert it.
Given that computers are still incredibly stupid, computer languages are carefully designed to be clearly understood by simple-minded idiots. A difficulty for humans is that they’re often too smart to easily grasp computer languages.
“Pick up that glass,” is too complicated for a computer to have any clue what you mean. For that matter, “that glass,” is too complicated. Did you mean some broken glass or a water-glass? For that matter, what do “glass” or “water” or “broken” (or “pick” or “up”) mean?
For a computer it’s more like: Look here. See this? Reach out. Grasp it. Look there. See that? Move grasped thing to that. Let go. Retract hand. Relax. All done!
There can be many layers or levels between a computer language and what the hardware actual sees as instructions. Each layer takes a richer language and converts it to a simpler language for the next layer. Given enough layers, you actually can say, “Pick up that glass.”
There is a very important — but sometimes fuzzy — distinction regarding how a computer language tells a computer what to do.
Some computer languages are just data — some form of content. The content can be very rich; it can include text formatting and images, even sound.
HTML document has meta-data that tells the computer how to format the text, where to put images and tables, how to build lists. The regular data provides the textual content you read.
HTML document can (but doesn’t have to) contain instructions in
CSS — a separate computer language that provides another (better) way to tell the computer how to format your text.
Both of these are just content, just data. They are not “active” or “intelligent” or even “dynamic.” Which brings us to the other type of computer language.
Some computer languages —programming languages — are code. Whatever they tell the computer to do, the result may have nothing in common with the code. (This is a key consequence of the distinction, not a definition.) It’s possible some part of the result may be visible in the code, but there is no required connection at all.
For example, consider the following “code”:
print "Hello, World!"
Clearly the expected output is found in the code itself. But consider code that creates a fractal image. There is no part of the image in the code. At a very high level, the “code” for the Mandelbrot fractal looks like this:
Z = Z2 + C
And from that comes the Mandelbrot. Looks totally different on TV.
There are three basic characteristics a computer language must have to be considered a programming language:
- Selection —
- Iteration —
- Storage – variables!
Selection: A programming language must be able to make choices depending on current conditions. The simplest expression of this is the
if statement. A more complicated version is a
Iteration: A programming language must be able to loop. There are different ways to accomplish this. The simplest is the
while loop (and its inverse, the
until loop). Some languages use recursion to accomplish iteration. Really crude languages use the
goto (combined with an
Storage: A way to save the state of information as it is processed. Variables (which come in a vast variety of types and kinds) are the standard way to save state. Variables represent the data within the code, and the science of variables (Type theory) is rich and complex.
CSS do not have any of the three required elements of a programming language. They are computer languages, but not programming languages.
HTML — Hyper-Text Markup Language. A computer language for writing web pages. (Any text with links to other text is called hyper-text. Markup is extra information about text formatting, images, tables, lists, and anything not actually text.)
CSS — Cascaded Style Sheets. A computer language for inserting text formatting meta-data into an HTML document.
Python, Perl, Haskell, Ruby, B, BPCL, C, C++, C#, Logo, Pascal, BASIC, Eiffel, Smalltalk, Scheme, Modula, Lisp, Erlang, Ada, Fortran, COBOL, SNOBOL, Forth, Algol — All programming languages! (To name just a handful.)