Difference Between Declarative and Imperative Programming in 60 Seconds

The terms declarative and imperative are often thrown around when talking about different styles in programming. Here's a short way to tell the difference.


Declarative "declares" a statement.

  • Get Groceries
  • My name is Matt
  • <img src="abc.jpg">
  • [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")]
  • Sum(orders)


Imperative gives step by step instructions how to do something.

decimal total = 0m;
decimal salesTax = 0.23m;
foreach (var order in orders)
    total += order.Total;

total = total + (total * salesTax);

Declarative programming is often an abstraction layer on top of imperative code.

One Last Thing...

If you have a question or see a mistake, please comment below.

If you found this post helpful, please share it with others. It's the best thanks I can ask for & it gives me momentum to keep writing!

Matt Ferderer
Software Developer focused on making great user experiences. I enjoy learning, sharing & helping others make amazing things.
Let's Connect