Why are programs written as a set of codes?

7 Answers

Relevance
  • keerok
    Lv 7
    1 month ago
    Favorite Answer

    A computer only understands two things, one and zero. Every bit of information, data, code, or program that a computer runs has to be translated to machine language which is comprised of a big bunch of ones and zeroes.

    Although it may be possible for humans to write in binary language (just ones and zeroes), it would horribly tedious to do so (who has the time to do that anyway?). What the computer experts did was to create programming languages which use common words from our language. Each programming language has a set of commands and stringing these commands together in sequence in creating the code to run a program. Codes make programming easier to understand on the point of view of the human.

    For the computer to understand everything, the human-coded program will have to be translated to machine language first. The translation happens quickly. The opposite also happens when the computer communicates back to the human so it will have to translate machine language back to programming language and then output to whatever application called for it which the user will be able to understand (hopefully).

  • 1 month ago

    because the source code you write has to be interpreted or compiled so that the computer can understand it.

    You can't create straight machine laguage.

    • Commenter avatarLogin to reply the answers
  • 1 month ago

       Hi. The actual reason is because "In the beginning" there were several different types of processors, & each one had their own ideas of what a CPU should be able to do.

       Eve though they all followed the standardized CPU details as far as the ASCII character set & other requirements to command a processor's basic functions, there was the added ability to extend the functions of a CPU & what the User can ask it to do built into the CPU itself.

       This was the main reason for the differences & extreme choosing of sides between the n AMD / Intel followings back in the 80's & 90's, & is the basic difference between a full CPU & a RISC processor.

       Those "command sets" are all actually fully customizable by design, & can still be expanded by the Mfr to include anything they want to work at the CPU level.

       The program makes use of the command set to access things like the MMX capabilities of an intel MMX processor, or the Glide functions on other chips, etc..

       They are also used to access the chipset commands available on a RISC processor, which stands for "(R)educed (I)nstruction (S)et (C)hip processor".

               G'Luck!!!

    • Commenter avatarLogin to reply the answers
  • Lv 7
    1 month ago

    coding languages exist as an easier way than just writing machine code. the "easy" code is translated into machine language, which is much less human-friendly, and harder to just "read". that way, more people can write programs.

    • Commenter avatarLogin to reply the answers
  • How do you think about the answers? You can sign in to vote the answer.
  • roger
    Lv 7
    1 month ago

    They  are not.  Code is a  collective  noun  for the algorithm used in a  computer  programme.   You  write  code   NOT  codes.

    • Your use of "code" is a slang'ed term used for programming as an action (He's a Coder). It's also able to be a definitive thing (Java/Python code, zipcode), and a blanket descriptor
      (coupon code, secret code, etc.). In this case the set of codes is programming terms.

    • Commenter avatarLogin to reply the answers
  • 1 month ago

    I retired after three decades of professional programming and never did that.  On one project in the late '70s, I had to write machine language subroutines in as a sequence (not set!) of codes, but that was a situation where no assembler for the processor was available.  (IBM 5110, with a quirky custom processor)

    As for why programs are written as sequences (not sets!) of statements or instructions (not "codes"), that's how a digital computer operates--and it also fits the definition of "program", in the relevant sense in plain, non-technical English: " a plan or system under which action may be taken toward a goal", according to my Merriam-Webster 11th New Collegiate.

    • Commenter avatarLogin to reply the answers
  • 1 month ago

    Not necessarily. LabView for example uses graphics.

    • Commenter avatarLogin to reply the answers
Still have questions? Get your answers by asking now.