IT lexicon Programming Declarative programming

Declarative programming

Programming På svenska → Updated: 2026-05-26

Paradigm: describe what you want, not how. Opposite: imperative (step-by-step). SQL, HTML, CSS, Prolog, Terraform, regex are all declarative.

Pros: shorter code, easier to read, compiler/runtime optimizes. Cons: harder to debug "magic", harder to add specific optimization hints. Functional programming is a subset (declarative + no mutation). React JSX is pseudo-declarative — you describe the UI tree, React diffs + applies. Terraform/Kubernetes use declarative manifests. The Pulumi vs Terraform debate = imperative vs declarative for infrastructure.

← Back to the lexicon