They provide a convenient way to express to a computer what we want to happen.
They provide a portable way of expressing a program.
Because assembly is just too painful for large scale use.
Machine Language -- 10101010101010111010101
Completely unintelligable
Required by the CPU
Sometimes done by hand (really, honestly, actually)
Assembly -- MV R1, R3
Non-portable
Optimally fast
One-to-one with machine language
Really painful as a programming language
Third Generation
This is the imperative languages (C, Cobol, Fortran, Basic)
Popular in the 60's thru 80's
Fourth Generation Languages
First meaning -- Object Oriented
Second meaning -- Cool advertising slogan that solves all problems
Second meaning (v2) – Domain specific programming language
But where is Prolog and Lisp????
They are generally slower than assembly.
They generally take more space than assembly.
They save programmer time (which can be used to optimize speed or space).
Some are general purpose (C++) and others are specialized (Simula, Mathmatica).
Imperative: Programs are a list of action to be taken (C, Basic, Fortran, Pascal).
Functional: Programs are a set of functions to be called
Don't have a loop, just call yourself recursively.
Lisp is the most common example.
Object Oriented: Package data with code, call the result an object
Nice way to promote code reuse.
Nice way to organize large codes
Not great for small programs.
Logical Programing: Write the program as a sequence of assertions, let the computer figure out the rest.
GREAT when in the right domain.
HORRIBLE otherwise.
Compiler
Idea: Convert the P.L. into machine code
Advantages: Fast execution
Disadvantages: Need to compile, not portable, poor debugging, large space required
Interpreter
Idea: Run the P.L. directly
Advantages: Portable, extensible code possible
Disadvantages: Slow execution, run time needed
Just In Time Compiler
Idea: Compile it on first execution .. run the compiled code thereafter
Advantage: Faster than an interpreter, no need for the programmer to compile, extensible code possible
Disadvantages: Execution speed between compiled and interpreted, not portable, COMPLEX
PseudoCode
Idea: Convert the P.L. to machine code for some virtual machine, run that
Advantages: Portable
Disadvantages: Medium execution, run time needed, poor debugging