Imperative Programming focuses on how a program operates. Declarative programing focuses on what the program should accomplish without specifying how it will accomplish it.

In a way, the Abstraction of Object Oriented Programming can be viewed as a more Declarative way of writing code.

How? By hiding the details, a class allows you to “ask” it to do something, without you having to know how it will accomplish the requested task.

For example, if I ask a widget factory class to hand me a widget, I expect to get a widget, but I don’t need to worry about how that widget was created. The implementation details have been abstracted away for me.

I know it’s not really the same thing, but the definition of Declarative programming reminds me of the abstraction that OOP offers.

Imperative vs Declarative (Why OOP is good)