A computer program is a set of instructions that tell a computer what to do. Are instructions specific orders of steps to do something. Like a recipe to bake a cake which is an example of where instructions may be used. Am I right yes or no? If I am not right please tell me why?
Are instructions specific orders of steps to do something. Like a recipe to bake a cake which is an example of where instructions may be used. Am I right yes or no? If I am not right please tell me why?
The computer does not know anything about the programs we give it to run. Our human readable code is interpreted and converted to byte code then compiled into the language the machine can run… Machine language, aka. binary executable.
If the instruction can be interpretted then it can be compiled. Errors found during interpretation are caught as Syntax Errors. Those that are not detected until a fault is encountered during execution are called Run Time Errors, or Exceptions.
A program may be loosely compared to a recipe, though the human writing the program is more likely the one following said descriptive instructions (known as ideation and implementation). The programmer has an objective, formulates a plan of attack, writes the instructions in the order in which they MUST be carried out, supplies needed data and data structures to maintain data integrity, then hands it to the computer to interpret and compile. If all goes well up to that point, the code will execute as planned and expected with the desired outcome. If not, well, back to the drawing board.
Let’s examine a very basic sequence of inline code using ES6
let a = 6; let b = 7; let c = a + b; console.log(c); // 13
The number literals as known as values. They are hardcoded into the program and likely reside exactly where they are written in the namespace. The interpreter, with the help of a number of system operations is able to draw a connection between the variable (a label) and the data it is associated with.
The third line tells the interpreter to fetch the values for
b and to perform an addition operation on them, which results in a new value that the system stores in memory and binds the location to the variable,
c. Now we can retrieve that value and log it to the terminal.
It looks simple and easy to us humans, but the computer is doing a tonne of work that we don’t see. It is not so simple at the machine level and there are a lot of moving parts. Thankfully in this day and age we don’t have to learn about those aspects like we would have had to in the early days of computers.
Bottom line, computers are dumb. We humans are the ones expected to think everything through, write concise code to follow our instructions, and then test and debug as needed until we have a finished model. Computers don’t make mistakes, people (programmers) do. Well written interpreters can spot syntactical errors, and well written compilers can usually identify where something has gone wrong, and maybe why, but they depend heavily on the person behind the program design and implementation to verify and validate everything they write into their code. The recipe analogy can only be taken so far by way of comparison.
Can you tell me the defintion of the instruction run? I can’t find the defintion of instruction in computer science in the Online English dictionary that I am using. Here is the link to the Online English dictionary that I am using.
Make sure you have a look at the online English dictionary and tell me which defintion of instruction is about Computer Science.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.