All subjects · Computer Science · WCP01 Principles of Computer Science
Programming paradigms: procedural and declarative
Edexcel IAL Computer Science · WCP01 Principles of Computer Science
A programming paradigm is a style or approach to writing programs. Unit 1 asks you to understand the procedural and declarative paradigms; you use them in Unit 2 (spec points 5.4.1 and 5.4.2).
Procedural paradigm
In the procedural paradigm (a kind of imperative programming) a program is a sequence of instructions that say how to solve a problem, step by step.
- Built from sequence, selection and iteration.
- Code is organised into procedures and functions (subroutines) that can be called and reused, with parameters and return values.
- Uses variables whose values (the program's state) change as it runs; local and global scope.
- Examples: Python (used procedurally), C, Pascal.
- Benefits: easy to follow for many problems, reusable subroutines, close to how the CPU works, good for algorithms. Drawbacks: large programs can become hard to maintain; changing global state can cause bugs; the programmer must describe every step.
Declarative paradigm
In the declarative paradigm the programmer states what result is wanted, and the language system works out how to get it.
- Examples: SQL (SELECT Name FROM Student WHERE Form = '12A' says what data is wanted, not how to search the table), and logic languages such as Prolog (facts and rules, then queries).
- Benefits: shorter code; the system can choose an efficient method; less chance of step-by-step errors; good for databases, querying and rule-based problems. Drawbacks: less control over how the work is done; can be harder to predict performance; not suited to every kind of task.
Comparing
| Procedural | Declarative | |
|---|---|---|
| Focus | How to do it | What is wanted |
| Program is | Ordered steps and subroutines | Statements of facts, rules or required results |
| Example | A loop that checks each record and prints matches | SELECT ... WHERE ... |
| Control of method | Programmer | Language system |
Worked example
Explain why the SQL statement SELECT Title FROM Book WHERE Year > 2020 is declarative.
- It describes the result wanted: titles of books after 2020.
- It does not say how to find them (no loop, no order of checking).
- The database system decides how to search the table.
Answer: It states what is required, not the steps to get it.
Check yourself
- SQL is an example of which paradigm?
- Procedural
- Machine code
- Declarative
- Assembly
Show answer
Declarative. SQL describes the data wanted, not how to retrieve it.
- Which describes the procedural paradigm?
- A program is a sequence of instructions, grouped into subroutines, saying how to solve a problem
- A program states facts and rules and the system finds answers
- A program describes only the result wanted
- A program has no variables
Show answer
A program is a sequence of instructions, grouped into subroutines, saying how to solve a problem. Procedural = step by step, with procedures and functions.
- Which is a benefit of declarative programming?
- The programmer controls exactly how memory is used
- It is always faster than procedural code
- The programmer does not need to specify the steps, so code can be shorter
- It is the only way to write loops
Show answer
The programmer does not need to specify the steps, so code can be shorter. The system works out the method.
- Which is a drawback of the procedural paradigm in very large programs?
- It cannot use functions
- Shared, changing global state can make programs hard to maintain and debug
- It cannot use selection
- It can only query databases
Show answer
Shared, changing global state can make programs hard to maintain and debug. Many subroutines changing shared variables can cause hard-to-find bugs.
- Explain the main difference between the procedural and declarative paradigms.
Show answer
Procedural code tells the computer how to solve the problem, step by step; declarative code states what result is wanted and the system decides how to achieve it.. How versus what.
- In the procedural paradigm, why are subroutines used?
- To make every variable global
- To break a program into reusable, named blocks of code
- To remove the need for selection
- To turn the program into SQL
Show answer
To break a program into reusable, named blocks of code. Subroutines can be called many times and tested separately.
Sources
Last updated 8 November 2026. Spotted a mistake? Tell us.