What is the Difference between Declarative and Imperative Programming Languages?

Declarative and imperative programming languages are two different types of programming languages. In this article, we will explore the differences between the two.

What is a declarative programming language?

The term declarative programming can refer to several different paradigms.

One definition of declarative programming is that the program tells the computer what is true, instead of giving commands in order to compute something.

That means they are very good at expressing relationships between items without having to worry about how these relationships are implemented under the hood.

Declarative languages tend to be very easy to read.

What is an imperative programming language?

An imperative programming language, on the other hand, needs the coder to describe the program flow precisely and clearly.

They instruct the computer on what instructions should be executed at each step of a process.

Imperative programming may use subroutines, loops, and other constructs that allow the programmer to create a step-by-step recipe for what needs to be done.

Declarative vs. imperative programming languages

In short, Declarative programming tells what should happen as opposed to how things should happen while imperative programming tells computers what to do next.

A declarative programming language forces people to think about what should happen as opposed to how things should happen. On the other hand, imperative language is basically telling the computer what to do next.

Some examples of declarative languages are SQL, Prolog, and Lisp. Some examples of imperative languages are C++, Java, JavaScript, PHP, etc.

Though nowadays most popular programming is based on an imperative approach because it’s easier to implement complicated things using this language paradigm. Declarative programming is more common in the academic environment, where the formal logical notation is preferred.


It is important not to mix up declarative with functional programming languages as the two concepts are similar but different from one another. Declarative languages can also be contrasted with imperative ones as they focus on what needs to be done as opposed to how things need to happen.

In an imperative language, you give your computer a list of steps and then it runs them; in declarative you tell your computer what result you want and then it figures out how to get there — e.g., compare “take these steps and put this object into that state” (imperative) with “I want this object to be in that state, so please take its current state and apply these operations to it” (declarative).

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.