Programming paradigm

Programming paradigms are a way to classify programming languages based on their features. Some languages are heavily slanted toward one paradigm — C is procedural, Java/C++ are almost entirely class oriented, and Haskell is functional. But many languages also support code patterns that can come from, and even mix and match from, different paradigms. So called "multi-paradigm languages" offer ultimate flexibility. JavaScript, for example, is a multi-paradigm language.

There are two main programming approaches: imperative and declarative.

Imperative programming

Imperative programming focuses on how to execute, defining control flow as statements that change the program's state.

Declarative programming

Declarative programming focuses on what to execute, expressing the logic of a computation without describing its control flow.

  • functional programming - the desired result is declared as the value of a series of function applications
  • logic programming - the desired result is declared as the answer to a question about a system of facts and rules
  • mathematical programming - the desired result is declared as the solution of an optimization problem

Resources