How does coding physically work?

112 viewsOtherTechnology

Like how exactly can a bunch of letters, numbers, and punctuation symbols make your computer do all kinds of things? Plus what happens inside the computer when it executes the code?

In: Technology

22 Answers

Anonymous 0 Comments

A switch on a wall turns on the light bulb if you flip it up, and it turns off the light when you flip it down.

Little while ago, we figured out how to make a switch that’s controlled by electrical signals instead of your hand.

Turns out, when you put bunch of them cleverly together, we can make just a few set of manual switches (that you turn on and off by hand) control a whole bunch of other switches to essentially do math like adding numbers.

And we also figured out that we can wire bunch of those cool things together to do even more complex math and decision making.

That’s today’s computer hardware.

Now, this hardware (very complex set of interconnected switches) can be built such that when the manual switch we control are set a certain way, it does something special like turning on a pattern of lights (we call this a screen), or setting some other switches to represent a result of a mathematical calculation.

For example, if switches 3 and 4 are turned on, the hardware might be built so switch 7 turns on to indicate the sum of two numbers.

Put bunch of these together, and we can come up with a series of switch positions (program and data input) that result in a certain pattern of other switch-settings and light-patterns appearing (output).

Originally, we only used the switch positions to program these hardware. Those would be represented as 0s and 1s (binary machine language). We called these software.

Soon enough, we realized that we can also build software that turn human-friendly keyword representations of what we want the switch positions to be into actual switch positions (assembly language and assemblers).

Since then, we built more and more complex software that translate what looks like what we speak in real life (if, else, while …) into the switch positions (high level languages and compilers).

So today, when we want to program the hardware, instead of writing down switch positions in 1s and 0s, we write code in languages like C, Java, Python, and JavaScript. They all eventually turn into the switch potions in 1s and 0s and run on the circuits that are made of switches that can be controlled by other switches.

You are viewing 1 out of 22 answers, click here to view all answers.