Expertain

A daily source for the latest news in technology, health and so much more
Menu
  • Technology
  • Animals
  • Science
  • Lifestyle
  • Travel
  • Health
  • Miscellaneous
  • Privacy Policy

Lorem ipsum dolor sit amet, consectetur adipiscing elit

Join Us Now For Free
Home
Technology
What are the 4 types of programming language?
Technology

What are the 4 types of programming language?

Margarita R. Cave June 20, 2020
0
SHARES
ShareTweet

“A philosophical and theoretical framework of a scientific college or discipline among that theories, laws, and generalizations and therefore the experiments performed in support of them area unit formulated”. this can be a paradigm consistent with Merriam-Webster’s desk dictionary. This begs the question of “What area unit the four sorts of programming language?”.




The four sorts of programing language are:

  1. Imperative
  2. Functional
  3. Logical
  4. Object-oriented

The Imperative programming paradigm

The Imperative programming paradigm was one in all the earliest ones to be developed, and it had been done therefore by exploitation machine-learning. It’s conjointly the premise of the total method of hardware implementation. This was confirmed by a broadcast journal by landowner back in 2009 that he clearly expressed that “In imperative programming, statements area unit directions at the native machine-level, and that they contain states and variables that time right to the memory.”

A lot of its deserves embody near to the machine – quick execution time and additional potency.

While, on the opposite hand, it’s weaknesses too. Its order sensitive and therefore the limitation of abstraction area unit the key weaknesses.

Here’s AN example of the Imperative programming paradigm:

int fact(int n) {
 int f = 1;
 while (n > 1) {
   f = f * n;
   n = n – 1;
 }
 return f;
}

“Notice the assignment operator, the equals (=) sign. the worth location of the variable itself was keep in memory” (Wikibooks, 2016)

Imperative programming vs Declarative programming

Imperative programming vs Declarative programming

The purposeful programming paradigm

Basically, this paradigm states that the programs area unit made by applying and composing solely functions. It’s additional of a declarative programming paradigm wherever functions area unit thought of as trees of expressions, and every one in all the returns a worth rather than a sequence of imperative statements – which might originally amendment the state of the program.

In purposeful programming, you’ll be able to image functions as fantabulous voters. This being aforesaid, they’ll be:

  • Bound to names
  • Passed as arguments
  • Returned from different functions

More or less like every different information sort will.




There area unit cases wherever purposeful programming is treated as a equivalent word for strictly purposeful programming, that may be a set of purposeful programming that treats all functions as settled mathematical functions – or pure functions.

Here’s AN example of the purposeful programming paradigm:

Function FindAvg(int x, int y){ return ((x+y)/2);}
Call to function will return an average without storage of value in memory
Imperative programming vs Declarative programming

Characteristics of functional programming

The Logical programming paradigm

Logical programming is that the strategy of exploitation logic circuits so as to manage however facts and rules area unit expressed. the alternative of this would’ve been exploitation solely mathematical functions.

More typically than not, particularly in genetic and organic process programming, this approach shows a model of what goal to accomplish instead of the way to get it on.




And also, rather than a very structured management flow dictating once to execute and measure perform calls, the program’s logic rules area unit written as logical clauses.

Here’s however it works to relinquish a far better picture:

Each rule contains a head and a body with formalized logic, that would’ve been whole totally different during a mathematical relation. “Z is true (this is that the heading): if A1, A2, and A3 area unit all true (this is that the body)”.

Here’s AN example of the Logical programming paradigm

  Brother(X,Y)                         /* X is the brother of Y                                   */
       :-                                  /* if there are two people F and M for which*/
       father(F,X),                       /* F is the father of X                               */
       father(F,Y),                       /* and F is the father of Y                            */
       mother(M,X),                   /* and M is the mother of X                             */
       mother(M,Y),                   /* and M is the mother of Y                             */
       male(X).                            /* and X is male                                  */
“That is X is the brother of Y if they have the same father and mother and X is male.” (University of Birmingham, n.d)

The Object-oriented programming paradigm

Object-oriented programming, that is best referred to as OOP, may be a variety of programming wherever you outline the info variety of an information structure, and at the same time the kinds of operations which will be applied to the aforesaid organization.

This way, the info structure becomes AN object that has each the info and therefore the functions within. in addition, programmers produce relationships between objects. In AN example, AN object will inherit the characteristics of another object.

One of the most benefits of exploitation Object-oriented programming is that it permits you to make modules that don’t want sterilisation once a replacement variety of object is supplemental. you’ll be able to merely produce a latest object that inherits a great deal of its options from the prevailing object. This makes the total method of modifying a great deal easier than the remainder of the paradigms.




Here’s AN example of the Object-oriented programming paradigm:

public class Example{
private String name;
public void setName(String n){name = n;}}Class Example has a method setname and a string n that is assigned to a variable name in memory.
Object-oriented programming visualised

Object-oriented programming visualized

0
SHARES
ShareTweet
Share
Tweet
Email
Prev Article
Next Article

Related Articles

Tech careers that don't require coding
Having coding skills is great, but not everyone is so …

Tech careers that don’t require coding

Everything you need to know about iOS 14
Apple is bringing a lot of changes with the new …

Everything you need to know about iOS 14

About The Author

Margarita R. Cave

Leave a Reply

Cancel reply

Find us on Facebook

Expertain

A daily source for the latest news in technology, health and so much more
Copyright © 2021 Expertain
Theme by MyThemeShop.com

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.