Patch panels, switches, and punch cards. Punch cards were already in use for programming looms to weave specific patterns(https://www.youtube.com/watch?v=x_ijmjx7Xys).
There were also computers made for a single purpose, which were programmed by design.
Electronic digital computers have “high” or “low”, but the association with “1” and “0” or with “yes” and “no” is arbitrary. It’s a meaning the human assigns.
The computer doesn’t “know” anything. The “yes” and “no” is our interpretation of the things a computer does.
The most simple example of a computer would probably be a calculator that is able to add things. In computer lingo, that is called an “adder”.
An adder has two inputs where you send it electricity, and two outputs to show the results. The way its designed give the following behaviour:
|Input A|Input B|Output S|Output C|
|:-|:-|:-|:-|
|Off|Off|Off|Off|
|On|Off|On|Off|
|Off|On|On|Off|
|On|On|Off|On|
If the outputs are linked to say an LED light, you can then tell based on looking on those outputs whether none, one or both of the inputs are on. This allows you to do any maths up to 1+1.
If you wanted to do bigger numbers, you can just add more of these adders to count each additional power of two in a similar way to how when you add two numbers on paper, you first add the ones column, then the tenths column, then the hundreds column etc (which are powers of ten).
The important part is that the computer doesn’t “know” what any of this means. We as engineers define what the different things mean. So, we say that the two inputs are the two numbers we want to add, and the two outputs represents the result.
When it comes to more complex things, this all build on this. If you see a red dot on your computer screen, the computer doesn’t “know” what that red dot is. It has just done a bunch of operations similar to above, and then based on that is sending a number to the screen to tell it which coluor it should have.
Edit: Made and fixed a typo in the logic table above /facepalm
edit 2: This got a bit of traction, so wanted to add two quick links.
If you want to have a good understanding of how computers work, from transistors to the internet, I would highly recommend [Crash Course: Computer Science](https://www.youtube.com/watch?v=tpIctyqH29Q&list=PL8dPuuaLjXtNlUrzyH5r6jN9ulIgZBpdo) on YouTube. It’s amazing.
If you want to truly understand how computers work on the most basic level, and want to follow along in building a computer from scratch, nothing is better than [Ben Eaters series on building a 8bit computer on breadboards](https://www.youtube.com/watch?v=HyznrdDSSGM&list=PLowKtXNTBypGqImE405J2565dvjafglHU).
The earliest computers were programmed with [punch cards](https://en.m.wikipedia.org/wiki/Punched_card). Binary data would be encoded in card by punching a hole for a 1 or leaving it blank for a 0. These punched cards predated the invention of the computer, having been used for mechanical tabulating and sorting machines before that. The earliest use of punched cards was for a programmable loom, invented in the 19th century for producing patterned fabric.
On a physical level, computers use something called “logic gates” to do calculation.
Originally they were constructed out of vacuum tubes, but modern ones are etched into silicon wafers by the billions, and those wafers go into CPU’s/Processors.
There are a few different types of logic gates, but each has 2 inputs and an output. If they receive the proper inputs they allow electricity through, which is interpreted as a 1, and if not they don’t let electricity through which is interpreted as a 0.
For example, the AND gate : If input 1 AND input 2 both receive an electrical current then the electrons can make it out the other end, which is seen as a 1.
If one of the inputs gets a current but the other doesn’t, or if neither gets a current, then nothing comes out the other end, which is seen as a 0.
There’s the OR gate which outputs a 1 if either input receives a current, as well as the XOR(Exclusive OR) which outputs a 1 if one of the inputs gets a current but not if both do.
There’s a few others, but the basic idea is that you can chain the outputs of one gate to the inputs of other gates to create a representation of logic you want the computer to execute.
The first “programming language” was chaining vacuum tubes together to get a machine that would give you a specific type of output based on what you initially put into it.
But to answer your initial question: The presence of an electrical current was a 1 and the absence of a current was a 0, and this 1 or 0 would cause the logic gate that received it to act differently.
I think the key point underlying this question is that the programming is not the thing that decides how the computer works. There are physical components called logic gates that work by manipulating current and can be combined to perform operations. These used to be made from vacuum tubes, but are now part of the silicon in a microchip.
An “or” gate has two input wires and an output wire. If both inputs are given a low voltage, the output is a low voltage. If either input is given a high voltage, the output is a high voltage. There are also logic gates for “and” where both inputs need to be high to get a high output, “exclusive or” where you need exactly 1 high input to get a high output, and “not” which only has 1 input and produces the opposite output.
With these components you can produce pretty complicated behaviour without writing a line of code. You can do all sorts of maths by stringing together logic gates in particular sequences. You could reprogram a machine like this by simply rewiring it, changing what outputs feed into what input to run a specific maths problem. From there it’s pretty convenient to create something that can read in input from a punch card or strip of tape and doesn’t have to be rewired every time. But everything ultimately comes down to electrical circuits made of logic gates changing voltages.
The first computers were really simple. The earliest microprocessors could be programmed by switches and buttons. You would arrange one set of switches for a memory address, and another set for the contents you wanted to write. Press a button and it would put that pattern into memory. Output was similar, a series of LEDs, one group for memory, one for contents of that memory.
Every generation of computers was programmed using the previous generation of computers. Those switches and LEDs were used to allow input from a keypad and output to a numeric display. Keypad and numeric display was used to program a keyboard and a alphanumeric display.
Think of it mechanically. Open or closed. On or off. Then you build patterns which represent a sort of math language. With math all things can be defined. The computer does not have input, the controller needs to input via punch card, input device or magnetic media. The original computers were weaving looms and the early weaving guilds were very secretive about their patterns and methods. I believe the first automated looms used punch cards that controlled the patterns and it’s possible this was the inspiration for the first computers.
Latest Answers