How does coding physically work?

815 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

i tend to mentally picture computers as a massive printing press that churns out, or sometimes operates on, millions of Lite-brite sheets (if you remember those)

some sheets stand for instructions or operations or functions; a single specific task. like add, subtract, or move/copy some Lite-brite sheets from here to there. Then other sheets stand for values, input, output, that we humans are interested in.

by themselves, individual pegs in the Lite-brite sheet do not make much sense. but step back and look at the sheet as a whole and it makes a picture, or a symbol.

and the symbols only have meaning because we humans collectively agreed somehow on specific combinations of pegs representing an idea everyone understands. like an alphabet for any of the many human languages used throughout the history of mankind.

so combinations of Lite-brite pegs make sense to us humans even though the machine, the computer, doesn’t really know or care about the meaning. or in a similar way, individual lightbulbs in a ticker display like the one in Times Square in NYC that displays scrolling messages like stock values or “Victory In Europe!”

making those Lite-brite sheets, or screwing in individual lightbulbs in a scrolling ticker, that gets real tedious real quick. so we humans make up new words that represent predefined configurations of pegs on a Lite-brite sheets.

Those made up words start to become a language of their own, a programming language, if you will.

And a special machine at the heart of this massive monstrosity has a few hundred specific predefined Lite-brite sheets it is built to look for. literally hardwired into the electronic circuit (i.e. hardware)

That is the central processing unit, or CPU.

Just like a printing press operates in a predetermined sequence of steps to create one page of today’s newspaper, the CPU has a similar set of predetermined steps that make up one cycle of operation

and since we’re talking about an electronic machine instead of a bigger more physical machine, we can execute many many more cycles each second.

put enough cycles together with enough Lite-brite sheets with the right set of CPU operations – add, subtract, move/copy, etc. – and you start to be able to do process lots of information very quickly

so our made up programming languages, which are basically pre made Lite-bright sheets, tell that CPU machine to perform the right specific operations on values we feed it – in the form of other Lite-brite sheets – in the right order and suddenly this big old Rube Goldberg machine starts doing things that make sense to us humans

Instead of Lite-brite sheets, call them punchcards, and you have the makings of some of the original computer systems. What gets called a programming language is just shorthand for the more complicated specific predefined sequence of holes in the punchcard (or pegs in the Lite-brite sheet)

and to make it so humans can read the results easier, the results are printed on something like a piece of paper, or a ticker display, or a monitor/screen, using symbols humans understand (easier than on off bits of the machine) like letters and numbers of a human language’s alphabet

crank out enough Lite-brite sheets per second and one can achieve something of a flip book effect!

sorry to ramble off the top of my head in the wee hours of the morning typing on my phone with my fat thumbs but hopefully that starts to help explain some of the basic ideas of how a computer and programming languages work at a ELI5 level without confusing things too much

or, at the very least, gives you a bit of a chuckle 🤭 (either way, it’s time for a nap for me)

best of luck on your adventures in understanding computers. have fun with it!

ETA: if you haven’t heard of Lite-brites, its an old toy that was a lot of fun to play with when i was a little kid. see https://en.m.wikipedia.org/wiki/Lite-Brite

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