Describe what you want — let something else figure out how to make it happen. The paradigm of SQL, HTML, configuration files, and modern UI frameworks.
← Back to FoundationsIn declarative code you state the desired result; an engine, compiler, or runtime works out the steps for you.
// Filter even numbers (JS) const evens = []; for (let i = 0; i < nums.length; i++) { if (nums[i] % 2 === 0) { evens.push(nums[i]); } }
// Same thing const evens = nums.filter(n => n % 2 === 0);
Compose pure functions; no explicit control flow.
Prolog, Datalog. State facts and rules; ask the engine queries.
SQL, GraphQL, SPARQL. Describe the data you want.
HTML, XML, JSON, YAML. Describe structure and content.
Terraform, Kubernetes manifests, Ansible. Describe the desired infra state.
React, Vue, SwiftUI, Jetpack Compose. Describe the UI for any given state.
SELECT name, COUNT(*) AS orders FROM customers JOIN orders ON customers.id = orders.customer_id WHERE orders.created_at >= '2026-01-01' GROUP BY name ORDER BY orders DESC;
You don't tell the database how to scan tables, build indexes, or join rows — its query planner figures that out.
<article> <h1>Welcome</h1> <p>This is a paragraph.</p> </article>
No drawing instructions — the browser handles layout, fonts, line-wrapping, accessibility tree.
function Greeting({ name }) { return <h1>Hello, {name}!</h1>; }
You declare what the UI should look like for any name; React figures out which DOM nodes to add, remove, or update.
resource "aws_s3_bucket" "reports" { bucket = "acme-reports-2026" versioning { enabled = true } }
You describe the bucket you want; Terraform creates, updates, or destroys resources to make reality match.
parent(tom, bob). parent(bob, ann). grandparent(X, Y) :- parent(X, Z), parent(Z, Y). ?- grandparent(tom, ann). true.
State facts and rules. Prolog's engine explores them to answer queries — no algorithm code from you.
button.primary { background: #065A82; color: white; padding: 10px 20px; border-radius: 6px; }
No drawing code — the browser engine maps your style declarations to pixels.
SQL, GraphQL — the engine optimizes; you describe results.
HTML/CSS, React, SwiftUI, Jetpack Compose, Flutter.
Terraform, Kubernetes manifests, CloudFormation.
YAML/TOML/JSON for application and CI config.
Make, Bazel — declare targets; the tool figures out order.
Drools, BPMN, decision tables in finance & insurance.
Real codebases blend paradigms. A typical web app uses:
The skill is recognizing which paradigm fits which problem — and switching cleanly between them in the same codebase.