Computer Science › Algorithms & Software
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Part of the Computer Science curriculum.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.