Imperative and Declarative Programming Paradigms

Programming Paradigm Concepts

Eleanor Thomas

Senior Data Analytics Engineer

Imperative and declarative programming

  • Two broad categories: Imperative
  • Programmer spells out the exact instructions for the program to follow, step-by-step
  • How the program should execute
  • ... and declarative
  • Programmer defines the logic of the program without details of the exact steps to follow
  • What the program should execute

Step-by-step flow diagram

Sudoku puzzle

Programming Paradigm Concepts

Imperative programming

  • Imperative programming is used in most mainstream programming languages
  • Includes procedural and object-oriented programming
  • More common because it is more similar to how a computer works
  • Note: Procedural programming is a type of imperative programming, although the terms are sometimes used interchangeably

Imperative vs. procedural

Programming Paradigm Concepts

Declarative programming

  • Less commonly used than imperative programming
  • Functional programming is a type of declarative programming
  • Declarative programming is also used in specific programming languages that are not general-purpose

Functional programming is a type of declarative programming

Programming Paradigm Concepts

Let's practice!

Programming Paradigm Concepts

Preparing Video For Download...