PROGRAMMING PARADIGMS
Programming paradigms are a way to classify programming languages according to the style of computer programming. Paradigms differ in the concepts and abstractions used to represent the elements of a program such as objects, functions, variables, constraints and the steps that comprise the computation. Features of various programming languages determine which programming paradigms they belong to.
There are two main programming paradigms.
Imperative programming
This paradigm one of the oldest programming paradigm and it is based on Von Neumann architecture. An imperative programming is a sequence of commands used to obtain a final result. In this approach we tell code what to do step by step.
Imperative programming languages
- C++
- C#
- C
- PHP
- Java
- Assembly
Advantages of Imperative programming
- Easy to implement.
- Easy to learn.(Easy to correct errors and modify instructions)
Disadvantages of Imperative programming
- Can’t use to solve complex problems.
- Difficulty of parallelization.
- Less productive and less efficient.
Declarative programming
Declarative programming is one of the important and widely used programming paradigms. In this paradigm the programmer defines what needs to be accomplished by the programme without defining how needs to be implemented.
Declarative programming languages
- HTML
- XML
- CSS
- SQL
- Prolog
- Haskell
Advantages of declarative programming
- Simple, efficient code
- Easy of maintenance and development
Disadvantages of declarative programming
- Risk of errors.
- Based on a conceptual model unfamiliar to people.
- Provide minimal input and output capabilities.