Paradigms of programming language
Some of the most common paradigms are:-
1) Imperative — Control flow is an explicit sequence of commands.
2) Functional (Applicative)— Computation proceeds by (nested) function calls that avoid any global state.
3) Logic (Rule-based) — Programmer specifies a set of facts and rules, and an engine infers the answers to questions.
4) Object-Oriented — Computation is effected by sending messages to objects; objects have state and behavior.
#Those were the most common paradigms of programming language.Other programming paradigms are as follows:-
* Structured : Programs have clean, goto-free, nested control structures.
* Procedural : Imperative programming with procedure calls.
* Declarative : Programs state the result you want, not how to get it.
* Function-Level : Programs have no variables.
* Class-based : Objects get their state and behavior based on members in a class.
* Prototype-based :Objects get their behavior from a prototype object.
* Event-Driven : Control flow is determined by asynchronous actions (from humans or sensors).
* Flow-Driven : Computation is specified by multiple processes communicating over predefined channels.
* Constraint : Programmer specifies a set of constraints, and an engine infers the answers to questions.
* Aspect-Oriented : Programs have cross-cutting concerns applied transparently.
* Reflective : Programs manipulate their own structures.
* Array : Operators are extended to arrays, so loops are normally unnecessary.
# Programming languages included in most common paradigms has been listed below:-
1) Functional- Lisp,ML,Scheme,etc.
2) Imperative- Fortran,algol,Pascal,C,Cobol,etc.
3) Logic- prolog Datalog,GHC,Parlog,Vulcan,Polka,Mercury,Fnil,etc
4) Object Oriented- C++,java,smalltalk,eiffel,delphi,etc.
# Along with that there are some programming languages which allows programming in many paradigms which is called multi-paradigm language.Some of it are python,PHP,perl,Scala,D,Ada,etc
#Information about some paradigms are as follows:
** Imperative paradigm **
Introduction:
- The imperative programming paradigm assumes that the computer can maintain through environments of variables any changes in a computation process. Computations are performed through a guided sequence of steps, in which these variables are referred to or changed. The order of the steps is crucial, because a given step will have different consequences depending on the current values of variables when the step is executed.
Advantages:
-efficient,close to the machine,popular,familiar.
Disadvantages:
-The semantics of a program can be complex to understand or prove.
** Logic paradigm **
Introduction:
- The Logical Paradigm takes a declarative approach to problem-solving. Various logical assertions about a situation are made, establishing all known facts. Then queries are made. The role of the computer becomes maintaining data and logical deduction.
Advantages:
-Programming steps themselves are kept to a minimum;
-Proving the validity of a given program is simple.
** Functional paradigm **
Introduction:
-The Functional Programming paradigm views all subprograms as functions in the mathematical sense-informally, they take in arguments and return a single solution. The solution returned is based entirely on the input, and the time at which a function is called has no relevance. The computational model is therefore one of function application and reduction.
Advantages:
-The lack of dependence on assignment operations, allowing programs to be evaluated in many different orders.
Disadvantages:
-Less efficiency
** Object-Oriented **
Introduction:
-Object Oriented Programming (OOP) is a paradigm in which real-world objects are each viewed as seperate entities having their own state which is modified only by built in procedures, called methods.Because objects operate independently, they are encapsulated into modules which contain both local environments and methods. Communication with an object is done by message passing.
Features:
-Objects are organized into classes, from which they inherit methods.
-The ability to use inheritance is the single most distinguishing feature of the OOP paradigm.
Its chief benefit over other programming paradigms - relatively easy code reuse and extension without the need to change existing source code.
-Ideally, the state of an object is manipulated and accessed only by that object's methods. (Most O-O languages allow direct manipulation of the state, but such access is stylistically discouraged). In this way, a class' interface (how objects of that class are accessed) is separate from class' implementation (the actual code of the class' methods). Thus encapsulation and information hiding are inherent benefits of OOP.