liveBook · Manning

Declarative programming

Also called declarative approach, declarative style, declarative way

Declarative programming is a programming paradigm that specifies desired results, states, or relationships without prescribing the step-by-step procedure to achieve them.

How 15 Manning books explain it

Functional Programming in JavaScript

A programming paradigm that describes what should be done by specifying desired results rather than the step-by-step control flow to achieve them.

How it is used
Frames functional programming as expressing program logic and desired output without exposing control flow or state changes.
How deep it goes
Contrasts imperative loops with map and develops chained map, filter, and reduce operations, without detailing declarative implementation internals.
Examples
Uses DOM message rendering, array squaring, person-name processing, country statistics, and filtering people born in 1903.
What you can do after
Apply it via Lodash.js and JavaScript function chains to express collection transformations without manual loops.

Read how Functional Programming in JavaScript explains declarative programming →

Kubernetes for Developers

Declarative configuration specifies the desired state of a system rather than a sequence of operational commands.

How it is used
Specifies the desired state of Kubernetes workloads so the cluster can establish and maintain it.
How deep it goes
Works through manifests, application, inspection, updates, and an imperative comparison without detailing controller internals.
Examples
Uses a three-replica container Deployment, imperative image updates, and YAML generation for a Secret.
What you can do after
Apply it via kubectl to deploy, inspect, update, and reproduce Kubernetes configurations.

Read how Kubernetes for Developers explains declarative programming →

Acing the CCNA Exam: Volume 2 Advanced Networking and Security

A declarative approach specifies the desired end state while leaving the sequence of operations needed to reach it to the automation system.

How it is used
Uses desired-state declarations to automate infrastructure provisioning and configuration management.
How deep it goes
Explains state declarations, planning, comparison, application, and state maintenance, but does not detail reconciliation algorithms.
Examples
Uses Terraform HCL configuration, a Puppet SSH service declaration, and provider-based infrastructure provisioning as examples.
What you can do after
Apply it via Terraform or Puppet by declaring target state and verifying or applying the resulting changes.

Read how Acing the CCNA Exam: Volume 2 Advanced Networking and Security explains declarative programming →

React Quickly, Second Edition

A programming style that specifies the desired result through expressions or descriptions rather than prescribing each execution step.

How it is used
Frames React's automatic view updates as an alternative to step-by-step UI instructions.
How deep it goes
Defines declarative versus imperative style and compares implementations, but does not develop the advanced functional concepts it mentions.
Examples
Compares a manual loop with `filter` when counting passwords of at least nine characters.
What you can do after
Evaluate/understand it by comparing stepwise code with an expression that states the desired result.

Read how React Quickly, Second Edition explains declarative programming →

Learn Haskell by Example

Declarative programming is a programming paradigm that specifies what results or relationships are desired rather than prescribing an explicit sequence of operations.

How it is used
Uses definitions of intermediate results to express computations clearly and maintainably.
How deep it goes
Explains definition-based computation, purity, effects, and order-independent intermediate results, while deferring deeper effect mechanisms.
Examples
Demonstrates declarative formatting through numbered lines, intermediate values, padding, and final string assembly.
What you can do after
Build it from scratch by decomposing a transformation into named intermediate definitions and a final expression.

Read how Learn Haskell by Example explains declarative programming →

The Art of Code

Declarative style expresses the desired result or transformation while minimizing explicit control-flow instructions for how to produce it.

How it is used
Uses functional pipelines to express transformations with less control-flow noise.
How deep it goes
Defines declarative style, contrasts it with imperative programming, and weighs readability, side effects, and performance.
Examples
Uses a Java stream to filter words, uppercase them, and collect the results.
What you can do after
Evaluate when a declarative pipeline clarifies a transformation and when an imperative approach better fits mutation or external interactions.

Read how The Art of Code explains declarative programming →

Road to Kubernetes

Declarative programming is a programming style that specifies the desired result or state rather than the step-by-step procedure for achieving it.

How it is used
Deploys applications and configures machines by declaring desired outcomes instead of prescribing operational procedures.
How deep it goes
Explains the output-versus-steps distinction and demonstrates YAML workflows and Ansible playbooks, without detailing tool internals.
Examples
Uses deployment statements, a GitHub Actions workflow, and Ansible configuration for Python, Node.js, NGINX, and Supervisor.
What you can do after
Apply it via YAML-based GitHub Actions workflows and Ansible playbooks to automate deployments and machine configuration.

Read how Road to Kubernetes explains declarative programming →

The Joy of JavaScript

A style of programming that expresses the desired result rather than the step-by-step control flow used to compute it.

How it is used
Frames functional JavaScript as readable, maintainable descriptions of transformations rather than machine-oriented control flow.
How deep it goes
Explains declarative flow through contrasts, composition, purity, and concrete pipelines, but defers framework-specific and formal language treatments.
Examples
Uses blockchain balance calculation, file word counting, SQL, and composed JavaScript functions as concrete examples.
What you can do after
Apply it via JavaScript function composition to express multi-step transformations with small, replaceable, single-responsibility functions.

Read how The Joy of JavaScript explains declarative programming →

Tiny Python Projects: Learn coding and testing with puzzles and games

Declarative programming is a programming paradigm that describes the desired result or rules without specifying every execution step.

How it is used
Frames regular expressions as a practical way to specify text patterns while delegating matching and replacement to Python.
How deep it goes
Defines declarative pattern description and contrasts it with manual iteration, without descending into regex-engine internals.
Examples
Uses vowel replacement, list comprehensions, map(), filter(), and a rhyming-word generator to demonstrate declarative descriptions.
What you can do after
Apply it via Python regular expressions to describe text patterns and replace matching characters without manual search loops.

Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains declarative programming →

Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu

A programming or configuration language in which the desired outcome or state is specified without prescribing the steps that produce it.

How it is used
Defines desired infrastructure in Terraform HCL so Terraform can plan the actions needed to reach it.
How deep it goes
Explains desired state, inferred ordering, deployment commands, and dependency cycles; defers deeper plan-graph debugging.
Examples
Uses a web application’s database credentials and host IP address to show inferred dependencies, plus a cycle that blocks launch.
What you can do after
Operate/configure it by expressing resource relationships in HCL, inspecting a Terraform plan, and applying the planned actions.

Read how Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu explains declarative programming →

F# in Action: A Revised Edition of Get Programming with F#

A declarative model specifies the desired structure or result of a user interface without directly prescribing the procedural steps to construct it.

How it is used
Expresses data transformations and user-interface structure while delegating low-level construction or execution details to compilers and libraries.
How deep it goes
Explains filtering, pipeline composition, immutability, and UI modeling, but does not descend into compiler implementation internals.
Examples
Uses even-number filtering, a football-results aggregation pipeline, and F#, XAML, Razor, and markup-based views.
What you can do after
Apply it via F# pipelines and collection functions to write shorter, composable transformations and succinct views.

Read how F# in Action: A Revised Edition of Get Programming with F# explains declarative programming →

Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

A declarative approach specifies the desired state of a system without specifying the procedural actions or execution order needed to achieve it.

How it is used
Uses infrastructure templates to define AWS environments without prescribing creation order or individual provisioning actions.
How deep it goes
Explains definition, imperative contrast, dependency handling, reproducibility, and updates without detailing CloudFormation’s internal reconciliation algorithm.
Examples
Uses virtual-machine creation, CloudFormation stack updates, parameter changes, and reproducible test and production environments.
What you can do after
Apply it via AWS CloudFormation by declaring infrastructure in JSON or YAML and updating the declaration when the desired state changes.

Read how Amazon Web Services in Action, Third Edition: An in-depth guide to AWS explains declarative programming →

BDD in Action, Second Edition

Declarative programming style expresses desired results or relationships without specifying every execution step.

How it is used
Expresses desired results in programs and business scenarios while reducing attention to low-level execution details.
How deep it goes
Defines the outcome-versus-procedure distinction and illustrates it with code and scenarios, without explaining language implementation internals.
Examples
Uses average-age calculations, restaurant requests, room tidying, and hotel-search scenarios to contrast outcomes with instructions.
What you can do after
Apply it by expressing computations and Gherkin scenarios as desired outcomes instead of detailed interaction sequences.

Read how BDD in Action, Second Edition explains declarative programming →

Kubernetes in Action, Second Edition

A declarative model specifies the desired state of a system while leaving the system responsible for determining and performing the operations needed to achieve it.

How it is used
Deploys and manages applications by expressing their components and configuration instead of directing each operational step.
How deep it goes
Explains description, deployment, health recovery, and change reconciliation, but does not detail Kubernetes internals.
Examples
Uses JSON or YAML application descriptions and contrasts them with one-line imperative deployment commands.
What you can do after
Operate/configure Kubernetes applications by submitting descriptions and relying on Kubernetes to maintain the declared configuration.

Read how Kubernetes in Action, Second Edition explains declarative programming →

Grokking Software Architecture

A programming approach that specifies the desired result or state rather than the steps to produce it.

How it is used
Defines desired infrastructure so Terraform can calculate and apply the changes needed to match it.
How deep it goes
Explains desired-state configuration, Terraform planning, and state tracking without detailing HCL syntax or engine internals.
Examples
Compares declaring a three-column SQL table with requesting a database and storage bucket in Terraform.
What you can do after
Configure infrastructure by declaring desired resources in HCL and letting Terraform determine how to provision them.

Read how Grokking Software Architecture explains declarative programming →

Also covered in

What to know first

Related concepts

Questions about declarative programming

What is declarative programming?

Declarative programming is a programming paradigm that specifies desired results, states, or relationships without prescribing the step-by-step procedure to achieve them.

Which Manning books explain declarative programming?

Functional Programming in JavaScript, Kubernetes for Developers, Acing the CCNA Exam: Volume 2 Advanced Networking and Security, React Quickly, Second Edition, Learn Haskell by Example, The Art of Code, Road to Kubernetes, The Joy of JavaScript and 7 more.

What should I know before learning declarative programming?

Manning books that teach declarative programming usually introduce YAML, functional programming, imperative programming and Document Object Model first.

What is the difference between declarative programming and imperative programming?

Declarative programming is a programming paradigm that specifies desired results, states, or relationships without prescribing the step-by-step procedure to achieve them. Imperative programming is a programming paradigm that expresses computation as ordered commands or instructions that direct execution or change state.

What kinds of declarative programming are there?

Kinds of declarative programming include HashiCorp Configuration Language, SQL, CSS, Docker and Kubernetes.

What is declarative programming also called?

Declarative programming is also called declarative approach, declarative style or declarative way.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.