Contributor: Jay Gregorio. Lesson ID: 13188
What do Minecraft, YouTube, Facebook, and Instagram have in common? These platforms use languages that keep us all connected! Learn universal coding concepts that give life to our digital world!
I'm sure you have used a microwave oven before. Without thinking, you open its door, put the food in, close it, and press the number. Then, the microwave oven will run the motor, which rotates the glass plate.
As soon as it turns, the microwave energy will cause the water molecules in your food to vibrate. This vibration will increase friction among these molecules, eventually resulting in heat. When the timer is up, the rotating plate stops, and the alarm dings to remind you that its job is complete!
Perhaps it would be helpful to keep your instructions very specific in a step-by-step process, as shown below.
Your interaction with the microwave oven is somewhat similar to the operational characteristics of coding: it involves a series of inputs and outputs.
Opening and closing the door, punching in the number of minutes, and pressing the START button describe the inputs you trigger as a programmer.
By performing these inputs, you expect the microwave oven to perform specific functions such as opening and closing the door, running for the allotted time, rotating the glass plate, ringing the alarm, and heating the food!
In this lesson, you will discover that there is more to coding than a simple set of instructions. Let's get started!
What Is Coding?
The step-by-step instructions on operating a microwave oven may sound simple enough, but we have a problem. Computers are unable to read this type of numbered instruction.
For example, when you open the microwave oven door, the oven's response is not simply allowing you to open it but also to stop emitting microwaves.
In other words, you have one input — opening the door — and the microwave has multiple outputs, allowing you to open the door, turn on the light, and stop microwave emission.
Let's break it apart further!
In the same way as the microwave oven, we ask the computer to do many different things, from sending emails to playing games. In reality, computers do not know what to do by themselves.
They need computer programmers to instruct them in numbers, letters, symbols, or combinations. These instructions are called machine codes.
The number codes in the above photo do not make much sense to humans. A programming language makes understanding the instructions easier for us and the computer.
These are just four out of the 698 programming languages that are currently used. Codes are easier to understand because of these languages.
For instance, you want the computer to say, "Hello, world." Instead of using a set of numbers or symbols, you can use a programming language, as shown below.
Almost all programming languages work the same way.
In summary, coding uses a programming language to tell the computer what to do.
There is only one instruction line in the above sample code. If you want the computer to do more, multiple lines are written. A document full of lines of code is called a script.
When you see a post on Facebook, you can press a button to like it, love it, or choose an emoji that perfectly describes your reaction.
The programmer had to create multiple lines of code to instruct the computer to respond to your reaction type. Once the script is compiled and executed, the programmer can save the script as part of the entire Facebook program.
Other apps, websites, and even the online games you play are examples of computer programs.
Learning How to Code
Even if you are confident in your knowledge of the fundamentals of coding, it requires advanced knowledge to use JavaScript, HTML, CSS, or Python. Fortunately, some programs will help us perform the same task. It is called block-based coding!
Block-based or block-based programming is coding within a programming language where instructions are mainly represented as blocks.
The example above was created using Scratch, which is a block-based visual programming language and an online community. On this website, you can use a block-like interface to create interactive stories, games, and animations.
Code.org is another program that teaches coding. Here, visual blocks can be dragged and dropped to write programs.
These programs deliberately use algorithms. An algorithm is a set of steps that can be followed from start to finish to complete a task.
In block-based coding, you add blocks to direct the sequence of events you want the computer to perform. Here is another more complex example created using Scratch.
You can create free accounts at either (or both!) of these websites to explore and learn more about block-based programming!
Time to head over to the Got It? section to explore different activities that will help you understand the basic computer-coding processes behind every program we enjoy today.