# The Hard Behind The Soft

As a starting developer you get to learn different methods and functionalities to complete tedious tasks that would take a normal human being a substantial amount of time to complete. Computers are a tool to make our life easier, more productive and efficient. But as any other person would ask themselves, how did all this software came about? was it delivered via lightning by the almighty greek god Zeus? or was it discovered by Nicholas Cage in one of his adventures lurking tombs and stealing fictional historical american relics? I am sorry to ruin your party but no it isn't any of the aforementioned.

For the purpose of addressing this common disconnect between how a computer was first built I will discuss how a computer transmits information in its most basic form. Before in time where any software was built there had to be some kind of computer/hardware that was able to redirect electrical current and perform connections based on conditions. First step to understand how computers use electric currents to create a command is by learning about “Logic Gates”, which is the most basic component of digital systems. It is an electronic circuit having one or more than one input and only one output. The relationship between the input and the output is based on a certain logic. Based on this, logic gates are named as AND gate, OR gate, NOT gate etc.The below is an example of all the different logic gates:

To have better understanding on how they work it is useful to understand how an electrical telegraph works. Just like logic gates; an electrical telegraph uses what is called key which pushes a current thru a circuit via a copper wire connected to a sounder with the help of a power source. For further clarification I have included the below image of the basic structure of an electrical telegraph.

In the image you can see an illustration of a key in which a single tap in the part labeled “K” will send out an electrical current into the sounder using a power source. This kind of technology was useful in its era for short distances. But lets say you wanted to send your friend living in another state a message but not enough power to get it delivered to him. This posed another challenge when it came to sending telegraphs across larger distances. In order to get your message across you would have to connect that electromagnetic current to another key and sounder using a relay and that will later then enable it to keep transmitting the signal until it reached its destination. This would later call upon the invention of the electromagnetic relay where you label the incoming key as an input and the key hitting the second sounder as the output.

When people discovered relays they realized they it would very very useful to use it in other practical ways other than connecting long distance telegraph messages. For example they would connect two relays together so if one was activated the other was activated and creating enough energy to light a lightbulb. This would create a system where some switched can be turned on from activating other switches. A good representation of this:

This kind of use opens a new world when it comes to using relays to perform different functions using electrical currents. It lets you connect to relays where one relays output triggers the other relays power source so without using its key. This would not allow both relays to be activated by a single stroke but by two independent strokes for both relays to allow the current flow into the light bulb. Depending on the positioning of the relays they will behave differently, lets say you connect the same relays but paralleled to each other the light bulb would light up if either of the relays would be activated. This would be the first introduction of logical operations into the world of computing via “Logic Gates”. In order to explain a little bit further you can create a combination of two relays that would only pass a current to a light bulb only when both relays are activated thus creating a “AND” gate. Consecutively you can also arrange relays in such a way that they would transmit an electrical current to light up the light bulb by activating either one of the relays thus creating an “OR” gate. If you have at least some experience with coding you can quickly relate this to the “AND” and “OR” methods used in meany conditional arguments in coding.

Furthermore there a far more methods that were created early in the 21st century using hardware that was used as the foundation of programing other and “AND” or “OR” gates. Experimenting with relays you would have probably come across an error while connecting electrical currents causing the electrical current to be activated in the relay unless it you would triggered to turn off. This kind of relays would be called an inverter because its output its inverse to its input thus creating an inverted relationship between both. Now for the sake of argument lets say you have an “AND” gate connected to an inverter that is will be outputting an electrical current to a light bulb unless it was told otherwise by “AND” gates attached to it. In order to stop the electrical current to be passed to the lightbulb both switches in the “AND” gate would have to be activated to cause the inverter to switch the power off for the light bulb. The same can be done by putting together an “OR” gate with an inverter where the inverter will always be transmitting power to the lightbulb unless one of the two switches is activated where its output will make the inverter stop the flow of its current.

These two basic relay logics that I explained are called a “NAND” gate and a “NOR” gate, as shown in image “a” of this post. The logic gates shown in this illustration represent the four most basic building blocks of any digital system or computer. In different configurations these gates can be used to perform countless types of operations or store information as memory in a computer. As you can see, computers started off just as a flow of electrical currents flowing from one relay to the other and us being able to manipulate it in a way that made us take advantage of it and use it to perform the complex operations that we know today. Seeing how simple it all began makes it a little bit less intimidating for any starting developer to quickly start thinking like a computer(with its limitations of course).

Like what you read? Give Jonathan Coll a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.