Does class Availability makes programming as Object Oriented Language ?

Most of the people think that if there is Availability Class in a language, then that language becomes Object Oriented. Is it true ?

According to me, its not class that makes the language object oriented, but the OOP Concepts that makes the Language Object Oriented right ?

If Class makes a language object oriented then Javascript is not a object oriented language, but JS is a object oriented language without any Class being implemented.

It also brings me to ask one more question, Can we implement all the OOP Concepts in JS ? i.e

Inheritance Data Abstraction Polymorphism encapsulation

Please let me know whether my understanding of JS is right or no ?

marked as duplicate by gnat, user40980, Ampt, Robert Harvey, Telastyn Nov 28 '14 at 17:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • If "JS is a object oriented language without any Class being implemented" - what are the objects around which it is oriented? – Mawg Nov 28 '14 at 15:57
  • its function right ? – Duster Nov 28 '14 at 16:00
  • 1
    Inheritance is unrelated to OO. There are different kinds of Data Abstraction, only one of which is object-oriented. Abstraction, Polymorphism and Encapsulation are consequences of OO. – Jörg W Mittag Nov 28 '14 at 16:18

No, (1) classes don't automatically make an object-oriented language nor does (2) lack of them make a language non-OO.

An example of (1) is Java: Java has classes, but that doesn't make Java OO; in fact, classes in Java are used for defining Abstract Data Types, in order to define objects, you need interfaces. It's the interfaces that make Java OO, not the classes.

An example of (2) is Self: Self is an object-oriented language with no classes.

JavaScript allows you to implement objects easily, by using what JavaScript calls "objects" (which are actually not objects in the sense of OO) in conjunction with closures. Whether or not that makes JavaScript an "object-oriented language" really depends on your definition of what an "object-oriented language" is. Is it a language which makes OO possible? Is it one that makes OO feasible? Is it one that makes OO easy? Is it one that guides you towards OO? Is it one that forces OO? Is it one that makes OO affordable?

You can use OO in assembly, if you want. Does that make assembly OO? (In fact, in one of his talks, Alan Kay has mentioned that he discovered a paper from 1953, which describes pretty much exactly his vision of OO, implemented in assembly.)

  • Would you argue that early versions of object pascal which supported classes and single-inheritance but no analogue to java's interface are not object-oriented, in that case? – Jules Nov 28 '14 at 17:30
  • Why is JS is called Object Oriented then ? – Duster Nov 28 '14 at 17:35
  • @Jules: I don't know enough about Object Pascal to judge that. OO is about messaging, if you can do messaging, then you can do OO. – Jörg W Mittag Nov 28 '14 at 17:39
  • @Duster: Why not? You can easily do OO in JS. It doesn't force you into OO, but it doesn't make it particularly hard either. Java doesn't force you into OO, either, and it is usually called OO. IMO, it's easier to do OO in JS than Java, so if Java is called OO, then JS certainly should be as well. Guy Steele argues that a language without Proper Tail Calls can't be OO, well, JS has Proper Tail Calls now, Java doesn't. – Jörg W Mittag Nov 28 '14 at 17:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.