Are you learning to code? Are you thinking about it, but the sea of programming jargon is putting you off? Don’t worry – you’re not the first and you definitely won’t be the last person to feel that way. Computer programming is actually very very simple to learn; it just doesn’t seem like it at first because, literally, it’s a different language. Once you get a handle on the various common terms and what they mean, it all becomes much clearer. Luckily, we’re here to help! Here’s an explain of 10 essential programming terms all newcomers should know…
Just like in ‘human’ languages, syntax refers to the grammatical rules of a programming language. Every language has its own specific syntax, and it’s important to get it right. Your code will not compile or run if your syntax has errors, like a missing bracket or a wayward semi-colon. The easiest way to ensure your syntax is on-point is to use a god code editor, which will highlight your syntax and give each element a different colour. Interpreters and compilers enforce syntax (more on that later).
A variable is a way to identify and store a piece of data that can change depending on conditions or information passed to your program. Think of it as a named container for a single piece of data or ‘value’ – in other words, kind of like how ‘x’ replaces a number in algebra. A different value can be assigned to a variable at any time, as and when you need it. Some simple examples of variables at work include storing the score in a computer game, or showing the cost of items at a till in the grocery store (the variables being the end score and the end total). The opposite of a variable, i.e. a piece of data that never changes, is a constant.
You know all those ‘if’, ‘true’ and ‘false’ words you see scattered through lines of code? That’s conditionals. Simply put, a conditional is an action that takes place in a program only if a specific condition is met. They are one of the essential building blocks of code, because they enable a program to act differently each time depending on the input. Conditionals will start off with an ‘if’ statement and will evaluate to either true or false. Essentially, they’re the decision makers of your program.
In object-oriented programming (i.e. languages like Java, Python, Ruby), objects and classes organise your data. An object refers to a combination of related variables, constants, functions, and data structures that can be collectively accessed and managed. For example, if you wanted to represent your family in code form (bear with us here), each separate family member would be an object, with differences in hair colour, eye colour, personality traits, and so on.
In object-oriented programming, classes are created to define objects within that class. Let’s stick with the previous ‘family’ analogy. You have, let’s say four ‘objects’ or family members – mother, father, brother and you. What are they members of? The same family, of course. In this case, the ‘family’ is the class that defines the members (objects) of the family. Classes work like a mini program within a program, providing the blueprint for the objects that the rest of the program uses.
Another building block of program code. A function is a set of instructions. written just once and with one result. It can then be run whenever and wherever needed by ‘calling’ it. When a function is finished running after its called, it returns a value (i.e. the result) back to the code that called it. It’s like a little errand boy. The function call specifies which particular function to use and what is required to get the return value. However, not every function has a return value.
Probably the easiest term on this list after ‘syntax’. A loop is a piece of code that runs itself repeatedly until a certain condition is reached (for example until it reaches 100 loops, or until it’s told to stop!). It’s most common use is to run a piece of code for every value in an array. All high level programming languages have various forms of loops.
Did you know the code you write isn’t actually what the computer uses? Instead it uses machine code, i.e. binary ones and zeros. A compiler is what translates one into the other. It also checks that your syntax is correct, and stops code from running if so. Similar to a compiler is an interpreter, which translates one program statement at a time and executes each statement as soon as it is translated.
An array is a type of value that contains a sequence of other values (or objects). This series of objects will be the same size and type. Each object/value in an array is called an array element, just to make things a little more complicated! Arrays are fixed in size and are used to store collections of data. Basically, it’s a type of data structure (like tables, records or trees).
This is pretty much exactly what you think (unless you’re thinking of a physical building filled with books that you can borrow). A library is an extensive collection of pre-written code for common functions and features. Instead of writing every single line from scratch, you can take some of this code and implement it, saving time and effort. Sometimes known as modules. All of the major programming languages will have vast libraries that are worth delving into.