A programming paradigm is an approach to solve problems using some programming language or also we can say it is a method to solve a problem using tools and techniques that are available to us following some approach. There are lots of programming languages that are known but all of them need to follow some strategy when they are implemented and this methodology/strategy is paradigms. Apart from varieties of programming language, there are lots of paradigms to fulfill each and every demand.
Imperative Programming as the name suggests is a type of programming paradigm that describes how the program executes. Developers are more concerned with how to get an answer step by step. It comprises the sequence of command imperatives. In this, the order of execution is very important and uses both mutable and immutable data. Fortran, Java, C, C++ programming languages are examples of Imperial programming.
Declarative Programming as the name suggests is a type of programming paradigm that describes what programs to be executed. Developers are more concerned with the answer that is received. It declares what kind of results we want and leave programming language aside focusing on simply figuring out how to produce them. In simple words, it mainly focuses on end result. It expresses the logic of computation. Miranda, Erlang, Haskell, Prolog are a few popular examples of declarative programming.
After getting the basics of understanding of both the languages now let u do discuss the key differences between these two different types of programming Imperative Programming Declarative Programming
In this, programs specify how it is to be done. In this, programs specify what is to be done. It simply describes the control flow of computation. It simply expresses the logic of computation. Its main goal is to describe how to get it or accomplish it. Its main goal is to describe the desired result without direct dictation on how to get it. Its advantages include ease to learn and read, the notional model is simple to understand, etc. Its advantages include effective code, which can be applied by using ways, easy extension, high level of abstraction, etc. Its type includes procedural programming, object-oriented programming, parallel processing approach. Its type includes logic programming and functional programming. It is simpler and easier for beginners to understand as compared to declarative programming. It is simple and easier for beginners to understand as compared to imperative programming. In this, the user is allowed to make decisions and commands to the compiler. In this, a compiler is allowed to make decisions. It has many side effects and includes mutable variables as compared to declarative programming. It has no side effects and does not include any mutable variables as compared to imperative programming. It gives full control to developers that are very important in low-level programming. It may automate repetitive flow along with simplifying code structure.