Why do we need a programming language?

     One way to think of programs is that they are a set of instructions given to the computer to execute certain operations. These instructions are written by humans but not in a human language. Computers don't understand basic human words, they understand binary. We see the number 7 as "7" but computers see it in a string of 0s and 1s as "0111". When it comes to instructing computers human programmers must make sure that the computer is able to understand it but if programmers were to give all instructions in binary it would become difficult for the instructors themselves to understand what they are doing. This is where programming languages come in.
     What a programming language allows programmers to do is to give instructions to the computer in such way that both human and CPU will understand. A programmer essentially tells the computer to retrieve and store various values to different variables and objects throughout their code. These instructions are written in such way that a human can understand what's happening when they give these instructions. In JS, if the programmer writes var x = 7 they know they are storing the value 7 to a variable called x. The computer will also understand this soon. Once the code gets passed through a compiler it becomes a series of 1s and 0s and the computer will carry out the code correctly. There are many phrases humans can give other humans inform x = 7 such as "the variable x equals 7" or "the value of the
variable x is 7" but a programming language makes it only one way to inform it so there is less confusion for the computer. What the language essentially did was give a format to the instructions so both programmer and CPU understand what's going on. It makes it easier and faster to make programs and makes it simple to understand code.

Comments

Popular posts from this blog

Favicons

Favorite Teacher Project Reflection

Emoti-Con 2019 Reflection