Overview
A programming paradigm is a principle or set of principles which define how human readable code should be put together at a high level of abstraction.
Most high-level languages utilize one or more paradigms to define characteristics of the language. Paradigms can focus on many different aspects of high-level code including code execution, organization, or syntax. There are two general paradigms, #Imperative and #Declarative, each containing more specific paradigms.
Imperative
The imperative paradigm focuses on how a program should run. Programs consist of commands for a computer to perform step by step. This is often in contrast to declarative languages.
Procedural Programming
Procedural programming consists of organizing code into procedures (aka. subroutines or functions) which are executed in a specific order to manipulate state. While this may sound similar to #Functional Programming, there are a few semantic differences between the two.
Object Oriented Programming
Object oriented programming is perhaps the most widely implemented and utilized paradigm in the modern era. Also known as OOP, this paradigm focuses on organizing code into logical groupings called objects, commonly implemented in programming languages as classes. Objects are a collection of data, commonly referred to as attributes or properties, and procedures, commonly known as methods. Objects are designed to interact with each other to complete the program. Popular languages include Python, Java, C++.
Declarative
Declarative programming focuses on what the outcome of a program should be. Programs are defined by the logic of a computation rather than explicitly defining a sequence of steps. Some examples of declarative languages include query languages (SQL, XQuery), logic programming (Prolog, Datalog), and RegEx.
Functional Programming
Functional programming utilizes a set of functions which each take input and output to manipulate values and return an output. Purely functional programming does not account for mutable state or side effects and only considers the given arguments when calculating a return value. This idea closely resembles mathematical functions by design. The absence of state and side effects in purely functional languages makes the output and execution of programs highly deterministic. This makes them less prone to bugs and errors, easier to test, and more suited to formal verification.