Machine code is the binary code which is executable and readable by a computer. It is normally generated by using a compiler and/or assembler on human readable source code written by a computer programmer. Machine code is often also often referred to as "binary" code, and a file containing machine code is often referred to as an "executable file" or "program".
Generation of machine code
On the original computer mainframe systems, computer programming was done directly in machine code. To program the computer, the programmer would flip switches on the computer to indicate a binary "0" or "1", or punch holes in a punch card or tape to be fed into the machine. This type of programming required intimate knowledge of the instruction set of the computer in question, as a given number may represent totally different instructions on different types of computers. It was also prone to errors, as a single incorrect or misread punch would produce unintended results. After the introduction of human readable assembly language and programming languages, direct programming in machine code became a much less common practice.
As graphical displays came to wider prominence, the generation of machine code was simplified by the introduction of assembly language. This language allowed each instruction given to the computer, such as to add the values at two locations together or jump to a certain point in the program, to be represented by a short word often known as a "mnemonic" rather than as a binary number. A program called an assembler was developed to generate the machine code from the written assembly code.
Assembly code simplified the generation of machine code by allowing instructions to be written as words, much easier for humans to remember and read, rather than as binary values. It also represented the first level of abstraction between programmer and computer, with the assembler program to translate between the binary code readable by the computer and the assembly language readable to the programmer. Programs called disassemblers were developed in short order to allow programmers to reverse the assembly process and convert a program back to its readable code.