Computer Science › Algorithms & Software

Programming Paradigms

0 of 14
  1. Concurrent Programming: Shared State vs. Message Passing

    Two different ways of thinking about multiple things happening at once — several tasks reading and writing the same shared memory, versus tasks that never share memory at all and only exchange messages.

    Read →6 sections13 min
  2. Logic Programming: Facts, Rules, and Queries

    A program as a set of facts and logical rules, with the answer to a question found by unification — the predicate logic already covered, turned into something a machine can search over directly.

    Read →6 sections13 min
  3. Declarative Programming: What, Not How

    Describing the result you want and letting the system figure out how to get there — SQL as the single most widely-used real example, and the same underlying idea logic programming already introduced.

    Read →6 sections13 min
  4. Imperative Programming as One Paradigm Among Several

    Every program you've written so far — variables, assignment, loops, mutation — was imperative all along, without ever being named as a CHOICE; here it finally gets named, and its defining trait (state that changes over time) gets held up against the alternatives that follow.

    Read →6 sections14 min
  5. Classes, Objects, and Encapsulation

    The object-oriented paradigm's founding move: bundle data and the operations on it together into one unit — a real formalization of the ADT interface/implementation split already covered, now with a name and a language construct of its own.

    Read →6 sections14 min
  6. Inheritance

    Defining a new class as an extension of an existing one — reusing what already works, overriding only what needs to differ, and inheriting a real, well-known trade-off along with the reuse.

    Read →6 sections13 min
  7. Polymorphism

    Writing code that works uniformly over objects of different types, each responding to the same call in its own way — the payoff that makes inheritance more than just a code-reuse shortcut.

    Read →6 sections13 min
  8. Pure Functions and Immutability

    A pure function's output depends only on its inputs, with no side effects and no mutation — the functional paradigm's founding move, exactly opposite to the mutable state imperative programming was built on.

    Read →6 sections12 min
  9. Higher-Order Functions and Map/Filter/Reduce

    Treating a function as a value — already covered as a language feature — becomes the functional paradigm's central idiom here: map, filter, and reduce replace explicit loops with functions that take other functions as arguments.

    Read →6 sections12 min
  10. Closures

    A function that remembers the variables from the scope it was created in, even after that scope has finished executing — the mechanism that makes returning a customized function from another function actually work.

    Read →6 sections11 min
  11. Pattern Matching and Algebraic Data Types

    Describing data as one of several distinct shapes, and branching on which shape a value actually has in one construct — real, structural pattern matching, not just a chain of type checks in disguise.

    Read →6 sections12 min
  12. Recursion as the Primary Loop

    Without mutation, a `for` loop's incrementing counter has nowhere to live — functional languages lean on the recursion already covered as their DEFAULT way of repeating an action, not just one option among several.

    Read →6 sections12 min
  13. Choosing a Paradigm for a Problem

    A closing, side-by-side guide across every paradigm covered — imperative, object-oriented, functional, logic, concurrent, declarative — organized by the shape of problem each one fits most naturally, and the real reminder that most languages in practice mix more than one.

    Read →6 sections14 min

Programming Paradigms

Part of the Computer Science curriculum.

Sort
1

What Is a Programming Paradigm?

A paradigm is a way of thinking about computation — what a program IS, not just what syntax it's written in — and every language you've used so far has quietly been making paradigm choices for you.

2

Concurrent Programming: Shared State vs. Message Passing

Two different ways of thinking about multiple things happening at once — several tasks reading and writing the same shared memory, versus tasks that never share memory at all and only exchange messages.

3

Logic Programming: Facts, Rules, and Queries

A program as a set of facts and logical rules, with the answer to a question found by unification — the predicate logic already covered, turned into something a machine can search over directly.

4

Declarative Programming: What, Not How

Describing the result you want and letting the system figure out how to get there — SQL as the single most widely-used real example, and the same underlying idea logic programming already introduced.

5

Imperative Programming as One Paradigm Among Several

Every program you've written so far — variables, assignment, loops, mutation — was imperative all along, without ever being named as a CHOICE; here it finally gets named, and its defining trait (state that changes over time) gets held up against the alternatives that follow.

6

Classes, Objects, and Encapsulation

The object-oriented paradigm's founding move: bundle data and the operations on it together into one unit — a real formalization of the ADT interface/implementation split already covered, now with a name and a language construct of its own.

7

Inheritance

Defining a new class as an extension of an existing one — reusing what already works, overriding only what needs to differ, and inheriting a real, well-known trade-off along with the reuse.

8

Polymorphism

Writing code that works uniformly over objects of different types, each responding to the same call in its own way — the payoff that makes inheritance more than just a code-reuse shortcut.

9

Pure Functions and Immutability

A pure function's output depends only on its inputs, with no side effects and no mutation — the functional paradigm's founding move, exactly opposite to the mutable state imperative programming was built on.

10

Higher-Order Functions and Map/Filter/Reduce

Treating a function as a value — already covered as a language feature — becomes the functional paradigm's central idiom here: map, filter, and reduce replace explicit loops with functions that take other functions as arguments.

11

Closures

A function that remembers the variables from the scope it was created in, even after that scope has finished executing — the mechanism that makes returning a customized function from another function actually work.

12

Pattern Matching and Algebraic Data Types

Describing data as one of several distinct shapes, and branching on which shape a value actually has in one construct — real, structural pattern matching, not just a chain of type checks in disguise.

13

Recursion as the Primary Loop

Without mutation, a `for` loop's incrementing counter has nowhere to live — functional languages lean on the recursion already covered as their DEFAULT way of repeating an action, not just one option among several.

14

Choosing a Paradigm for a Problem

A closing, side-by-side guide across every paradigm covered — imperative, object-oriented, functional, logic, concurrent, declarative — organized by the shape of problem each one fits most naturally, and the real reminder that most languages in practice mix more than one.