By this I mean, when you write code, what exactly gives that the power to do anything is it more code? 0’s and 1’s? more so, what gives that thing the power to do anything? At some stage I can only deduce what must just be magic making it work because it’ll boil down to something metal and plastic ‘talking to’ an electric current, which doesn’t make sense at all
In: Engineering
From the start of writing code and all the way down to electrical signals go a lot of layers of abstraction. I think it’s easier to start from the bottom and go all the way up:
– Let’s take a light. You can turn your light on (1) and off (0).
– A screen is basically a set of a lot of tiny lights arranged in a grid. Someone made a basic controller that will read a stream of 1’s and 0’s to turn on each of those lights.
– Now comes the processor. It’s easy to make one that just counts 2 numbers together by [comparing input signals](https://www.wikihow.com/Add-Binary-Numbers). The result can be sent to the previous display controller by converting that result it into a stream of 1s and 0’s (eg 3+4=7. This 7 can be mapped to a long line of 1s and 0s to display it on our primitive screen)
– similarly the processor can perform other commands: subtract, multiply, store in memory, read from memory.
– one smart person created a language (assembly) that instead of writing 1s and 0s to let the processor do these commands, you could use simple text commands. When you write such a program, you let it compile (convert) the text into those bits.
– another smart person then used that language to create a higher level language. It would use those simple functions to let you write `if`, `loop` and many more commands that are more human readable. Again when you compile that text, with the help of the assembly language, it turns into 1s and 0s
– now you can create another higher level (easier) language which just combines these commands of the previous language.
You could go on and on, and developers basically write functions that just combine the available functions of a language like it’s a set of LEGO.
Latest Answers