VJAI
VJAI

Reputation: 32758

Difference between object oriented and object based language

What is the difference between an object oriented and an object based programming language? Is JavaScript is an object oriented or based?

Upvotes: 14

Views: 40487

Answers (5)

Vaira vel R
Vaira vel R

Reputation: 1

The following example is a general usage of a class in JavaScript: image

Result in the console: image

The proto references the Animals prototype (which in turn references the Object prototype). From this, we can see that the constructor defines the major features while everything outside the constructor (sing() and dance()) are the bonus features (prototypes).

Upvotes: 0

Jess
Jess

Reputation: 3715

I found there are two version of answer for this question.

Firstly, you must define what is object-oriented language.

  1. From English wiki, you can find that class-based language is object-oriented language, and prototype-based language is not object-oriented language. They think if a language only uses "object" is not enough,so it is not an object-oriented language.
  2. From mozilla, you can find that prototype-based language is object-oriented language. Because they think if a language uses "object", it is an object-oriented language. And then they divide object-oriented into two type:
    • class-based and object-based object-oriented.
    • object-based(or prototype-based) object-oriented

My English is not very good. If you are Chinese, you can see Chinese wiki.

Upvotes: 0

P Kulek
P Kulek

Reputation: 31

Object Oriented is based on message passing, no classes or inheritance involved.

"Object oriented" coined by Dr Alan Kay has been hijacked by C++, Java and Co, Dr Alan Kay made it clear that OO was messages, not classes. Dr Alan Kay On OO "OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things."

Erlang, LISP, Smalltalk are OO programming languages, not C++, Java, c# etc which are in effect object based.

Upvotes: 3

Zar E Ahmer
Zar E Ahmer

Reputation: 34360

Object-oriented language

Object-oriented language doesn't has in-built object. It has all feature of OOP. Object-oriented languages are C++, C#, Java etc

Object-based language

Object-based language doesn't support all the features of OOPs like Polymorphism and Inheritance. It has in-built object like javascript has window object.languages are Javascript, VB etc.

Upvotes: 0

TJHeuvel
TJHeuvel

Reputation: 12608

Wikipedia says:

In computer science, the term object-based has two different senses:

  • A somehow limited version of object-oriented programming, where one or more of the following restrictions applies: (a) There is no implicit inheritance, (b) there is no polymorphism, (c) only a very reduced subset of the available values are objects (typically the GUI components).

  • Prototype-based systems (that is, those based on "prototype" objects that are not instances of any class).

Javascript is object based.

Upvotes: 15

Related Questions