Object oriented vs Object based
Java is object oriented
JavaScript and VBScript are examples of object based programming languages.Just using objects does not mean you are doing OOP, even in a fully OO language if you are not implementing OO techniques it is simply object-based programming.
Object-oriented language supports all the features of OOPs.
Object-oriented language doesn't have in-built object.
Object-oriented languages are C++, C#, Java etc.
Object-based language doesn't support all the features of OOPs like Polymorphism and Inheritance
Object-based language has in-built object like javascript has window object.
Object-based languages are Javascript, VB etc.
Why JavaScript isn't an object-oriented programming (scripting) language? Because it has no feature that fits the requirements of the definition of object-oriented programming:
- Polymorphism: No. You can change the behavior of a prototype member, but this is just reusing the identifier. You aren't able to access the previous implementation of the member in a pseudo-derived object.
- Inheritance: Not at all. Maybe prototype chain might be comparable to inheritance but JavaScript (ECMA-Script 5.x or earlier versions) has no syntax-based inheritance like other OOP-based languages (i.e. Java, C#, Ruby, Python, VisualBasic.NET, ...).
- Encapsulation. Yes, of course, but there's no way to create actual private or internal object members.
Comments
Post a Comment