PGP Demo Examples
Each paradigm lesson names a small set of representative languages — the ones that make that paradigm's ideas most visible. Every one of those languages gets a short, self-contained example here, syntax-highlighted for that specific language in the code viewer, so you can see the paradigm's shape in real code without installing anything.
How to use: click View to open a file in the code viewer and read its comments. These are teaching snippets, not runnable projects — most need only a standard interpreter/compiler for that language if you want to try them yourself (a Prolog demo needs SWI-Prolog, a Lisp demo needs any Common Lisp, and so on).
Linear
| # | Language | Description | Link |
| 1 | XML | A data-oriented document, read top to bottom, no branching. | View |
| 2 | BASIC | Classic line-numbered BASIC, written without GOTO to show pure linear flow. | View |
Structured
| # | Language | Description | Link |
| 3 | Pascal | Decision, repetition, and selection — the three block shapes, in the language designed to teach them. | View |
| 4 | Fortran | The same three shapes in the language that made structured programming famous alongside Algol. | View |
Object-Oriented
| # | Language | Description | Link |
| 5 | Smalltalk | The language that defined OOP's vocabulary — everything is an object, responding to messages. | View |
| 6 | Java | Encapsulation, inheritance, and polymorphism, in the language that made OOP mainstream. | View |
Functional
| # | Language | Description | Link |
| 7 | Lisp | The first functional language (1960): functions as data, recursion instead of loops. | View |
| 8 | Haskell | Pure functions, immutability, and laziness, taken to their logical conclusion. | View |
Logic
| # | Language | Description | Link |
| 9 | Prolog | Facts and rules instead of steps — you describe relationships, the engine searches for answers. | View |
Aspect-Oriented
| # | Language | Description | Link |
| 10 | AspectJ | A logging aspect that crosscuts every matching method call, without editing those methods. | View |
Component-Oriented
| # | Language | Description | Link |
| 11 | JavaScript (Web Components) | A self-contained, reusable <counter-button> element with its own encapsulated state. | View |
| 12 | C# | Interchangeable components composed entirely through an interface, never a concrete class. | View |
Hybrid
| # | Language | Description | Link |
| 13 | Python | Structured, object-oriented, and functional style mixed freely in one small file. | View |
Practice move: pick one demo whose language you've never touched — Prolog and Smalltalk are the least familiar to most readers — and try to explain, line by line, what makes it feel different from the language you use daily. That difference is the paradigm.