Demystifying Programming Series (Part 1): What Exactly is Programming?
Programming is the foundation of most of what we use every day: our computers, our phones, our cars, even sometimes our fridge, etc. However, only about 0.5% of the world’s population knows how to code! This means 99.5% of the population does not fundamentally understand how most of the things they use every day works. This article even claims that coding in today’s world can be compared to reading in the 1800s. That being said, as one part of the 0.5% of the population who knows how to code and is alarmed by the statistics I have shared above, I thought I would start a blog post series focused on explaining fundamentals of programming. As the first post of the series, I am answering some commonly asked questions by people who have no programming knowledge whatsoever. Enjoy!
What is programming?
In simple terms, programming is the process of writing and designing code that makes a computer do things. It is basically a set of instructions for the computer to execute. For example, to turn on an iPhone, you have to hold down the power button. This means an engineer has written a piece of code which can be converted into words as “when the power button is pushed, turn on the phone”. Obviously, it is more complicated, but this is the main idea of what a program does.
What is a programming language?
A programming language is the way to communicate with computers. Just in the way humans communicate with languages like English or French, it is possible to communicate with computers using programming languages. On a personal note, I was (and frankly still am) so impressed by the fact it is possible to talk to machines. It’s something I have always found cool and fun to play around with. Just like dialects, there are a large amount of programming languages. The most commonly used ones are Python, JavaScript, HTML/CSS and Java.
If there exist multiple programming languages, how do you know which one to use?
As I mentionned before, it is possbile to compare programming languages to our dialect languages. For example, you can say “Hi” in English, French, Spanish, etc. and you use the most appropriate language depending on the context. You can apply the same reasoning to choosing a programming language. You can program the same outcome in a lot of different languages, but you choose the one most fitting in your project’s context. Performance, relevant libraries, environment such as mobile or web are examples of elements considered when choosing a programming language for a project.
What does code look like?
To simplify it as much as possible, code is just a bunch of functions (which are also called methods or procedures) utilizing variables. A variable is the same as variables used in mathematics: they are symbols which can hold information. An analogy for them could be a container that can hold one element at a time. Basically, if you put a spaghetti in that container, you could say the value of that container is spaghetti. You can also decide to change what’s in your container: you could remove the spaghetti and put salad in it. At that time, your container’s value would be salad. Variables follow the same logic: you can assign values to them, and, in most cases, you can change this value over time. As for functions, they also have the same meaning as mathematics functions. They are reusable blocks of code that perform a single action. Keeping the same food analogy before, a function could be performing an action on the container, such as eating what it contains. This eating function will change the container value, as initially, the container will be full of spaghetti and after this function has been executed, the container will be empty. This function is also reusable; you can eat in any container, not only the one with spaghettis in it. Therefore, you can call the same “eat” method to eat other containers with different values like chicken or salad.
Here’s a real code example (in JavaScript) of a function:
function add(){
const a = 2
const b = 6
const c = a + b
}
As you can see, a, b and c are variables and hold values, and the method “add” performs the action of adding a and b
How do I get started?
If you have been interested in learning how to code for a while or if this post inspired you to do so, here are some online websites with courses that will help you get started: CodeAcademy, Udemy, Khan Academy. I highly suggest you go checkout one of these websites whenever you have some free time. Some courses are quick (< 1hour) and will give you great fundamentals.
To finish off this post, I want to mention once again the importance programming has in today’s world and how crucial it is for everyone to at least be able to understand code.
Hopefully this post demystified what programming is and made some of you want to learn how to program!