This article attempts to set out the various similarities and differences between the various programming paradigms as a summary in both graphical and tabular format with links to the separate discussions concerning these similarities and differences in extant Wikipedia articles.
There are two main approaches to programming:
Imperative programming – focuses on how to execute, defines control flow as statements that change a program state.
Declarative programming – focuses on what to execute, defines program logic, but not detailed control flow.
The following are widely considered the main programming paradigms, as seen when measuring programming language popularity:
Procedural programming – specifies the steps a program must take to reach a desired state.
Functional programming – treats programs as evaluating mathematical functions and avoids state and mutable data.
Object-oriented programming (OOP) – organizes programs as objects: data structures consisting of attributes and methods together with their interactions.
The following are common types of programming that can be implemented using different paradigms:
Event-driven programming – program control flow is determined by events, such as sensor inputs or user actions (mouse clicks, key presses) or messages from other programs or threads.
Automata-based programming – a program, or part, is treated as a model of a finite state machine or any other formal automaton.
Reactive programming is a declarative programming paradigm concerned with data streams and the propagation of change.
The subroutines that implement OOP methods may be ultimately coded in an imperative, functional, or procedural style that may, or may not, directly alter state on behalf of the invoking program. There is some overlap between paradigms, inevitably, but the main features or identifiable differences are summarized in this table:
Despite multiple (types of) programming paradigms existing in parallel (with sometimes apparently conflicting definitions), many of the underlying fundamental components remain more or less the same (constants, variables, datafields, subroutine calls etc.