Introduction to Writing Code for Computers

Code-Negosentro

Writing code is writing of a precise set of instructions that a computer or device can understand. It’s explaining exactly what you want your computer to do at any given moment. Computers need to know exactly how to react to things like the clicking of a mouse or the pushing of a button. And whatever happens ultimately is happening because of lines of code written by a human programmer. 

What Is Code?

Just about anything with a plug or battery uses code. Code is keeping airplanes in the air and it’s allowing you to swipe a credit card. The computer doesn’t know what to do in any given situation; it has to be taught everything. You can think of a computer programmer explaining to a computer what they wanted to do, just  like someone trying to give directions for how to drive somewhere when they don’t even know what a car is. So, you can see what kind of complications you’d run into. You’d have to not only tell them how to get to where they’re going, but you’d also have to give them contingency plans for things like what if there’s a traffic jam or what if a truck breaks down in the turn lane. You’d even need to explain precisely how the steering wheel or the gas pedal works. That’s kind of like a computer programmer writing code for a computer. They have to basically teach it everything every time.

Basic Laws of Code

To understand that communication and how would this process even start, you have to go back to the Industrial Revolution, where the first computer program was invented in 1801 by a person named Joseph Jacquard. He developed a system of weaving instructions or code for his sewing rooms that could be stored on cards with holes. There was a mechanism that would go along the card and try to push a pin through. So, either the pin would go through or it wouldn’t. This process is called binary; it’s one or zero. If the pin goes through the hole, it would allow a thread attached to it to lift, which lifts the string and lifts the associative thread. And if the pin does not go through a hole, the pin doesn’t move and the thread doesn’t move. With this contraption, you could create very fancy pieces of weaving. This concept was borrowed by mathematicians. Charles Babbage invented the analytical engine in 1837, and it was basically a calculating machine. 

What’s Involved in Writing Code?

Eventually, transistors were invented to replace punch cards as a way of transferring data. Nowadays programmers use computers that have billions of transistors but still carrying that same basic idea of on and off to carry data. As a way of harnessing these various combinations of transistors, programmers use code. Computer programmers use different languages, whether it’s python front end for gaming, java for desktop applications or effective C for an iPhone app. A computer program is only a text file following those rules, and it’s eventually translated into something the computer can understand. 

Binary Code

Just like the pins on Jacquard’s loom, computers can only understand two things. Think of one and zero as the alphabet of a computer. It’s like if you look at the alphabet of the English language, there are only 26 letters, and by themselves, they’re meaningless. But when you combine them into different ways, you get the Great Gatsby or Romeo and Juliet. In the same way, billions of different combinations of ones and zeros have the potential to give us Microsoft Word or iTunes. The top level of a human writing code for a specific computer language is translated or compiled into a low level language by the compiler. Finally, the code is translated into binary or machine using an assembler. 

Because we have a way of translating human orders in the form of code into ones and zeroes that a computer can understand, it’s really just a matter of what you want the computer to do.

For more articles, Visit Negosentro