Want to keep learning?

This content is taken from the Coventry University's online course, Get ready for a Masters in Data Science and AI. Join the course to learn more.

Avoiding ambiguity

Computers are not very clever, and they don’t do very clever things. They appear to be doing clever things, however, just by doing incredibly simple things very, very fast.

How fast are we talking exactly? Well, a 3 GHz processor is doing around 3bn of these very simple things per second. Instructions like, ‘add 1 to this value’ or ‘change the current location in memory to equal this location’, for example.

Every single thing that your computer does, from displaying a web page to playing some music, is the result of a huge amount of these very simple instructions being executed very fast. This is low-level code.

Fortunately, when we write code, we don’t need to break our processes down to this level. We can write what’s called “high-level” code, which is a code designed to be more usable by humans.

However, even though we can write at a high level, our instructions still need to be translated down to a low-level version for the computer to be able to run them. There is normally a special program to do this for you, but your code needs to be unambiguous enough that it is possible to do so.

What is ambiguity?

For something to be ‘ambiguous’, it just means that there is more than one way to interpret it. Think about the sentence, ‘I saw a man with a dog on a hill with a pair of binoculars’. There are a number of ways this could be interpreted:

  • You were on a hill, with a dog, and you used binoculars to see a man
  • You saw a man who had a dog and a pair of binoculars on a hill
  • You saw a man with a dog on a hill, using a pair of binoculars

Human languages are generally very ambiguous when spoken. We as humans can cope with this because we use context, body language, and guesswork to somewhat overcome this ambiguity. Computers are not capable of doing this yet, and thus when we are writing code for a computer, we need to be very specific about what needs to happen.

In order for our high-level code to be this specific, we need a language with some very rigid rules. In data science and programming this is known as the language’s ‘syntax’, which is simply a fancy word for ‘rules’.

Share this article:

This article is from the free online course:

Get ready for a Masters in Data Science and AI

Coventry University