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 even thinking, you open its door, put the food in, close the door, and press the number. Then, the microwave oven will do its job by running 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 triggered by you 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 ultimately 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 how to operate 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 door of the microwave oven, 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 which is opening the door, and the microwave has multiple outputs which are allowing you to open the door, turning on the light, and stopping microwave emission.
Let's break it apart further!
In the same way as the microwave oven, we ask the computer to do a lot of different things, from sending emails to playing games. In reality, computers do not really know what to do by themselves.
They need computer programmers to give them a set of instructions in the form of numbers, letters, symbols, or a combination of these. These instructions are called machine codes.
The number codes you see in the above photo do not make a lot of sense to humans. To make it easier for us and the computer to understand the instruction, a programming language is used.
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 is the process of using a programming language to tell the computer what to do.
In the above sample code, there is only one line of instruction. If you want the computer to do more, then multiple lines are written. A document full of lines of code is called a script.
When you see a post on Facebook, for instance, you can press a button to like it, love it, or choose an emoji that perfectly describes your reaction to the post.
The programmer had to create multiple lines of codes to give instructions to the computer for it to respond to the type of reaction you choose. 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
Block-based coding 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 the idea of 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 continue to add blocks in order to direct the sequence of events that 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.