This story was created for the Google Expeditions project by Vida Systems, now available on Google Arts & Culture.
Computer programming is the way humans give computers instructions.
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.
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’.
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.
Test
The Hello World! Program is also widely used as a test to see if the computer language is installed correctly.
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!).
Programmers need to tell the computer what each variable means before beginning to code in order for the variables to work.
Python
This particular computer programming language is called Python.
Equals
In this language the = sign tells the computer to create a variable.
Changing variable
Changing the variable changes the outcome. How many variables are changed in the two sets of instructions?
Text
These instructions tell the computer to type out what the code says. To create the fantastic graphics is far more complex!
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.
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).
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’.
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’.
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’.
Else
Here, the computer recognizes that the variable is not ‘tyrannosaurus rex’. It’s next step is to print ‘woof?’
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.
The print command tells the computer what text needs to be displayed on the screen.
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.
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.
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.
Many computer programmers prefer to work with a few languages in particular, similar to preferring one brand of cola over another.
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.
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.
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.
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.
Some programmers concentrate solely on games, others on business software and others on creating beautiful VR worlds!
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.
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.
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!