No matter what type of language you use to write a program, the computer receives commands from the same set of very simple instructions defined by its architecture. High-level languages, such as object-oriented and scripting languages, give programmers a useful set of tools for calling combinations of these simple instructions in a concise and human-readable format. Low-level languages give the computer its instructions one at a time and require knowledge of its CPU registers and instruction set architecture.
Machine Code and Assembly Programming
Assembly language was the first attempt to make programming easier for people than directly supplying machine code to the CPU. Machine code is the most basic form of computer instruction, encoded as integers in binary format. Assembly uses a concept called abstraction to convert human-readable commands, such as ADD, MOV and INC, to numbers that a computer understands. Although assembly programming uses abstraction, it's a low-level language because it requires knowledge of a computer's architecture. Therefore, unlike high-level code, assembly code for one architecture, such as x86, is incompatible with another, such as PowerPC.
Assemblers, Compilers and Interpreters
Low-level languages use assemblers to scan human-readable code and arrange assembly instructions in a sequence compatible with a CPU's dispatch unit, the component that executes each instruction. High-level languages use compilers or interpreters to convert very abstract human-readable code to machine code at run time or compile time. Compilers produce faster-running programs than interpreters do because compilers convert all human-readable commands to machine code before the program runs. Interpreters convert source code to machine code at run time, as each instruction is executed, slowing down performance.
Types of High-Level Languages
Languages such as C, C++ and Java use compilers, and of these three, C is the fastest because it doesn't require a lookup table for classes, as C++ does, or run in a virtual machine, as Java does. Scripting languages, such as Python, PHP and Bash, run in interpreters and don't need to be compiled. This convenience makes them ideal for writing code that needs to be frequently updated, but it makes them bad choices for performance-intensive tasks, such as 3-D rendering. Most high-level languages are imperative languages because they explicitly define each instruction as well as its order in the program. Less commonly used functional languages, such as Haskell, Mercury and SequenceL, tell the computer how to arrive at the desired outcome without defining a step-by-step procedure.
OOP languages, such as C++, Objective C, Java, Python and PHP, are the most common application programming languages and may use compilers or interpreters. What makes them different from other high-level languages is their use of classes, inheritance and polymorphism. These concepts take months of study to understand, but in simple terms, a class is a customizable data structure with built-in functions for changing the state of its data; inheritance is the process of adding data fields and functions to existing classes to form new child classes; and polymorphism is the ability of a class to have many identities at the same time. Due to this class hierarchy, OOP languages take longer to compile and run than other high-level languages, but the process of inheritance makes them better for organizing large applications with many components and purposes.
- Swanson Technologies: Introduction to Assembly Language
- University of Aberdeen School of Engineering: Compilers & Assemblers
- Teach ICT: 14. Comparing Compiler and Interpreter
- Dr. Dobbs: Why Code in C Anymore?
- Microsoft MSDN: Functional Programming Vs. Imperative Programming
- Hobart and William Smith Colleges Math and Computer Science: Section 5.5 -- Inheritance, Polymorphism and Abstract Classes
- Photo Credit scyther5/iStock/Getty Images