Language Paradigms

Imperative or structured/procedural programming -- Process-oriented
It is based on the von Neumann architecture where data and programs are stored in the same memory. The CPU is separate from the memory, so instructions and data must be piped from memory to the CPU. Results of operations are moved back to memory.

Because of this architecture, the central features are:
  • variables (model the memory cells)
  • assignment statements (based on piping operation)
  • iteration form of repetition (most efficient method).

    The primary problem-solving technique is to decompose a problem algorithmically. Each module in the solution denotes a major step in the overall process. You solve the problem by asking what tasks do you want to accomplish and then you write functions to accomplish these tasks and send information, variables, into the functions.

    Object-oriented -- Data-oriented
    It grew out of structured programming, but supported data abstraction which encapsulates processing with data objects, hiding access to data. The paradigm concentrates on the use of abstract data types to solve problems.

    Decompose a problem by the key abstractions in the problem domain. The key abstractions become the objects. An object is a tangible entity exhibiting some well-defined behavior. Objects do things that we ask by sending them messages (calling functions). So instead of asking what tasks do you want to accomplish, you model the world of the problem into classes of objects and then ask what tasks should those objects do.

    What is the difference?
    The algorithmic view highlights the ordering of events, of the tasks. The object-oriented view emphasizes the "things" that either cause action or are the subjects upon which these operations act.

    Another two well-known paradigms, which are still used, but not as much as procedural or object-oriented, are functional and logic.

    Functional
    Its primary means of computing is by applying functions to given parameters. Everything is a function. The best known language is Lisp, or some variation of Lisp such as Scheme. In Lisp, everything is a list, and lists are typically built up or broken down. The name Lisp stands for list processing.

    Other languages can be used in such a manner. For example, javascript includes a library called Functional which allows it to be used for functional programming.

    Logic programming
    It is rule-based. Rules are specified in no particular order and the language implementation figures out a result using logical statements. The language used is Prolog which stands for programming logic.