Still used in very simple computers or at low levels, e.g.:
Embedded systems (e.g., IoT devices, cars, microwaves, ...)
Microcontrollers
Some operating systems
Is compiled to machine code
Third Generation
Compiled or interpreted code
"Human readable" code, like Python
Is compiled or interpreted to machine code
4th and 5th Generations
Us. Professional coders.
There are technically 4th and 5th generation languages, but the
distinction is less clear. They're typically defined as less
instruction-oriented and more problem-oriented.
Don't worry about them. They're for analysts and engineers who
don't know how to code.
Compiled vs Interpreted Code
All code must be converted to machine code before it can be run. The
difference is in when and how this conversion happens.
Compiled Code
A compiler is a program that translates code written in
a high-level language to a lower level language ahead of time. Compiled
languages cannot be run until the compiler has translated the whole
program into machine code.
Takes the actual text of the program and converts it into instructions
that the processor can execute.
Output is either a file that is directly executable or a library that
can be used by other programs.
Advantages
Faster and more efficient execution (since it knows what to expect
ahead of time)
Can catch errors before the program is run
Can be optimized for specific hardware
Can be distributed without the source code
Disadvantages
More complex development process
Examples
C, C++, Rust, Go, Swift, Java, C#...
Compile a C program with gcc
Run a Python program line by line
Interpreted Code
An interpreter is a program that reads code and
executes it line by line at runtime.
Picks off a statement, translates it to machine code, and runs it.
Then does the next statement, and so on.
Advantages
Fast to develop b/c you don't have an intermediate compilation
step.
Less complexity in the development process.
Often easier to debug.
Disadvantages
Slow execution
Less efficient use of system resources
Can't catch errors until the program is run; e.g. Python code
broken on line 12 won't be caught until... we hit line 12. This
leads to buggy releases.