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).

Practise this in the app: instant marking and a fix for every mistake. Free, no email needed to start.

Practise this lesson

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.

Declarative paradigm

In the declarative paradigm the programmer states what result is wanted, and the language system works out how to get it.

Comparing

ProceduralDeclarative
FocusHow to do itWhat is wanted
Program isOrdered steps and subroutinesStatements of facts, rules or required results
ExampleA loop that checks each record and prints matchesSELECT ... WHERE ...
Control of methodProgrammerLanguage system

Worked example

Explain why the SQL statement SELECT Title FROM Book WHERE Year > 2020 is declarative.

  1. It describes the result wanted: titles of books after 2020.
  2. It does not say how to find them (no loop, no order of checking).
  3. The database system decides how to search the table.

Answer: It states what is required, not the steps to get it.

Key idea: Procedural: step-by-step instructions (how), subroutines, changing variables. Declarative: describe the result (what), e.g. SQL; the system decides how.

Check yourself

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Practise with instant feedback

Sources

Last updated 8 November 2026. Spotted a mistake? Tell us.