Programming

Writing instructions for a computer to carry out is called programming the computer, or simply programming.

Programming a computer is done using a programming language.

"A programming language is a formal language designed to communicate instructions to a machine, particularly a computer." (Programming Language, Wikipedia)

Programming Languages

Some commonly used programming languages are:

  • Python
  • C++
  • Java
  • Javascript
  • C#
  • PHP
  • Scala
  • many more ...

There are many programming languages: List of Programming Languages (Wikipedia).

The commonly used programming languages have many concepts and features in common.

If you know one programming language learning another is much easier.

Syntax, Semantics - Dictionary Definitions

A programming language has a structure as does any human language.

Some definitions:

Syntax - Syntax is the grammatical arrangement of words in sentences. (WordNet) Also, see Wikipedia.

Semantics - Semantics is

  1. The study of language meaning
  2. The meaning of a word, phrase, sentence, or text

(WordNet)

Also, see Wikipedia.

Programming languages have syntax and semantics also.

Syntax and Semantics - Human Communication

Humans communicating using a human language can often understand one another if the rules of the language are broken.

If the syntax is not followed communicating humans can often adjust and get the meaning.

If the semantics are not quite correct the listener can often get the idea.

Programming Language Syntax and Semantics

The syntax and semantics for a programming language are precisely defined.

  • If the syntax of the programming language is not followed the computer will not "understand" the instruction and will usually give an error message.
  • If the semantics are not specified correctly the computer will do what the programmer has instructed it to do, not what the programmer thinks she/he has instructed it to do.

Example, bad syntax:

To the walked green house Jane.

Example: correct syntax, bad semantics:

Colorless green ideas sleep furiously. [Chomsky, Wikipedia]

Pseudocode vs. Programming

With pseudocode the computing agent is usually a human.

Pseudocode is flexible, the syntax and semantics are loosely defined.

A human executing pseudocode can use human judgement when executing pseudocode.

With the precise specification of the programming language and the requirements of computer hardware a number of issues must be dealt with in programming that pseudocode allows the programmer to ignore.

We will see these as we encounter them.