What is the programming paradigm used by Javascript?

Asked

Viewed 5,420 times

22

What is the programming paradigm used by Javascript or if it is like Python that uses multiple paradigms?

1 answer

27


Today any language mainstream (which everyone knows and uses, which has popularity) uses various paradigms.

The main of them all (only among the mainstream) is the imperative, JS is no different, and can even be used in the form procedural (obviously in a way structured).

Javascript is known to also be object-oriented through prototypes.

But like all modern language, it drinks in the paradigm functional increasingly.

We cannot fail to note a strong influence on programming event-oriented.

Recently object orientation can be expressed through classes also, albeit only in a syntactical way. Even so the use is a little different from what we find in the most known languages called OOP (C++, C#, Java, etc.), even because dynamic typing forces differences. Anyway it adopts a little OO style, but it is far from being purely OO, as is Smalltalk, for example.

The language uses dynamic typing (for the time being :P) and is used as script. It is said as weak typing, but this does not occur in all situations, possessing primitive types (contrary to what the comments below say) and dictionaries to fill the prototypes and simulate the classes (natively in the language). It usually goes round and round interpreted, but in the background is compiled.

Language had a strong influence on Self which is a purely object-oriented language. And Scheme that is functional in a pragmatic way. In addition to the many existing imperative languages.

Understand What is a paradigm?.

  • 3

    however we should note that object orientation in javascript is very different from the "pure" concept of object orientation that other languages like C++, Java, among others have. Don’t try to use the traditional concepts in it that don’t work. If you read English, see here my fight in this regard: http://codereview.stackexchange.com/questions/115645/simple-object-oriented-calculator-part-4

  • 3

    @Nelsonteixeira really, everything in javascript is object =)

  • 1

    Javascript follows the actual implementation of object orientation, which we have in Smaltalk, that there are no primitive types. This is why he said that this OO differs somewhat from the best known(class-based).

  • @nbro I think you need to understand a little better what the paradigm means. You probably have an own view of what OOP is that does not fit with what is accepted even in the different accepted definitions.

  • 1

    There’s nothing that forces OOP to support classes. JS supports classes, before ES6 supported prototypes which is a valid mechanism for obtaining the same class functionalities, supports encapsulation, inheritance, and polymorphism. Everyone can have their opinion, have mistakes in the design of JS but in general it is one of the most ingenious languages ever created at least for its initial purpose. I don’t even like and I don’t usually use JS, but she’s much better than some bloggers like to say. In general people who do not understand programming languages, which is a complex domain.

  • Some questions that may help: http://answall.com/q/88546/101, http://answall.com/q/108047/101, http://answall.com/q/13372/101, http://answall.com/q/108548/101,

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.