Computer Programming

Computers communicate using their own language. Computers need to be given instructions before they can run any sort of operation, they are unable to think on their own.

This story was created for the Google Expeditions project by Vida Systems, now available on Google Arts & Culture.

Computer Programming by Vida Systems

Computer programming is the way humans give computers instructions.

Tap to explore

Programming Basics

Computers cannot understand human language and humans cannot understand binary (computer language). To overcome this obstacle an intermediary language is used. These are languages computer programmers use to create software, or tell the computer what task to operate. The computer programming languages, like C++, Python and Javascript take human instructions and translates them into binary code. 

Tap to explore

Hello World!

The Hello World! program is often the first program aspiring computer programmers learn. The lines of instructions given to the computer is called ‘code’.

Tap to explore

Syntax

The way code is written looks very different to how humans speak. Computer programmers need to be very careful when writing code. Computers follow instructions to the letter.

Tap to explore

Test

The Hello World! Program is also widely used as a test to see if the computer language is installed correctly. 

Tap to explore

Variables

Variables are small words or numbers that store a larger amount of information. This is an essential tool for computer programmers as it saves them a lot of time (and typing!).

Tap to explore

Programmers need to tell the computer what each variable means before beginning to code in order for the variables to work.

Tap to explore

Python

This particular computer programming language is called Python. 

Tap to explore

Equals

In this language the = sign tells the computer to create a variable.

Tap to explore

Changing variable

Changing the variable changes the outcome. How many variables are changed in the two sets of instructions? 

Tap to explore

Text

These instructions tell the computer to type out what the code says. To create the fantastic graphics is far more complex!

Tap to explore

Logic and flow

Logic and flow refers to the pathways computers use when a human selects an option. It also refers to the order in which instructions are performed by the computer program.

Tap to explore

Writing a computer program is not linear, many tasks can only be performed based on a task completed beforehand (for example the user cannot open a locked door before finding the hidden key).

Tap to explore

Variable

In this code the variable is ‘animal’. In one of the programs the variable is defined as ‘rhinoceros’ and the other the variable is defined as ‘tyrannosaurus rex’.

Tap to explore

Options

We’d like the dinosaur to roar, however if any other animal is selected by the user we’d like that animal to say ‘woof’.

Tap to explore

Equality testing

The double == is telling the computer to check whether the variable is ‘tyrannosaurus rex’. If it is, the next step is for the computer to print ‘roar’.

Tap to explore

Else

Here, the computer recognizes that the variable is not ‘tyrannosaurus rex’. It’s next step is to print ‘woof?’

Tap to explore

Function

A function is a task which the computer is asked to perform. Functions are particularly handy to create when the computer needs to perform a repetitive task. Like a variable, functions need to be defined by the programmer in the code before it can work.

Tap to explore

Print

The print command tells the computer what text needs to be displayed on the screen.

Tap to explore

Definition

At the beginning of this code the term ‘def’ means define. It tells the computer what word will be inputted when the function is required be performed.

Tap to explore

Repeat

Once the function is set the programmer only needs to code the previously defined word to perform that function, in this case copy and paste multiple dinosaurs.

Tap to explore

Languages

Just as there are a number of human languages there are a number of computer programming languages available. Each language essentially can get the computer to complete the same task, however the way some of these languages store and retrieve instructions are quite different.

Tap to explore

Many computer programmers prefer to work with a few languages in particular, similar to preferring one brand of cola over another. 

Tap to explore

Different languages

Here are three different computing languages all asking the computer to complete the same task (create the awesome Fighting Tyrannosaurus Rex). Each one asks the computer in a slightly different way but produces the same result.

Tap to explore

Memory

Some languages requires the programmer to explicitly keep track of the memory used by all the variables - which is a lot of work for the programmer! While other languages free up the computer’s memory once a variable is no longer needed.

Tap to explore

Trade-offs

Different languages perform the same tasks in different ways. Some languages are easier to learn but runs slower. Others runs very fast but is time consuming to program. Programmers will decide which language is best to use based on the desired end result.

Tap to explore

Life of a programmer

Computer programming can be a creative and rewarding career. Just like there are different types of authors, programmers can work on all different types of software.

Tap to explore

Some programmers concentrate solely on games, others on business software and others on creating beautiful VR worlds!

Tap to explore

Creative

To be an effective programmer you need to be both creative and logical. Computers will do exactly what you tell them to do - no more, no less. It’s important to know every part of what your user is likely to try and do and keep the program intuitive. 

Tap to explore

Bugs

Computer programmers often need to comb through existing code to discover why a feature in a program is not working. This can get very frustrating as even missing one letter or symbol can stop the entire process working. 

Tap to explore

Streamlined

Once you become really great at coding the challenge is trying to make the code functional and streamlined. Looking for a bug in many lines of code is very difficult and time consuming!

Credits: All media
The story featured may in some cases have been created by an independent third party and may not always represent the views of the institutions, listed below, who have supplied the content.
Explore more

Interested in Science?

Get updates with your personalized Culture Weekly

You are all set!

Your first Culture Weekly will arrive this week.

Home
Discover
Play
Nearby
Favorites