Skip to content

Programming Paradigm

In one line

A programming paradigm is a style or philosophy of writing code, like imperative, declarative, or object-oriented.

In simple words

A programming paradigm is a way of thinking about and structuring your code. Different paradigms approach problem-solving differently — they are like different schools of thought in programming.

Major paradigms include:

  • Imperative: step-by-step instructions (C, Pascal)
  • Object-oriented: organize code around objects and classes (Java, C#)
  • Functional: pure functions, no side effects (Haskell, Elixir)
  • Declarative: describe what you want, not how (SQL, HTML)
  • Procedural: a subset of imperative, organized into procedures/functions (C, Fortran)

Most modern languages support multiple paradigms. JavaScript can be imperative, object-oriented, or functional. Python supports OOP and functional styles. Choosing a paradigm depends on the problem, the team, and the language. Understanding multiple paradigms makes you a more versatile programmer.

Example

javascript
// Imperative style — step by step
let total = 0;
for (let i = 0; i < arr.length; i++) {
  total += arr[i];
}

// Functional style — declare what you want
const total2 = arr.reduce((sum, n) => sum + n, 0);

// Object-oriented style — organize around objects
class Calculator {
  sum(arr) { return arr.reduce((a, b) => a + b, 0); }
}

The same task (summing an array) in three paradigms: imperative (loop), functional (reduce), and OOP (class method).

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary