How Does the Coding Work?
How Code Works?
Computers have a lot of constraints and are by themselves. They can only do a small number of things. The power that the computer programmer adds through coding. It puts these small things together in the right order to produce something much bigger.
Coding is much like “writing a recipe“. You assemble ingredients (the data) and give the computer a step-by-step recipe for how to use them.
Example:
Step1: Load photo from a hard drive.
Step2: Resize photo to 400 pixels wide by 300 pixels high.
Step3: Apply sepia filter to photo.
Step4: Print photo.
This is what’s known as pseudo-code. It isn’t written in a valid computer programming language, but it represents the algorithm that you want to use. In this case, the algorithm takes a photo, resizes it, applies a filter and then prints it. It’s a relatively straightforward algorithm, but it’s an algorithm nonetheless!
In the algorithm, a step-by-step list of instructions for the computer. These instructions will get more complex but the principle is the same: You are simply telling the computer what to do, one step at a time. Each programming language is a high-level, pre-defined way of expressing these steps. The compiler knows how to interpret the code you write and convert it into instructions that the CPU can execute.