-
Is JavaScript an OOP?
For those of your unfamiliar, OOP is Object Oriented Programming. There has been a long debate on whether JavaScript is one.
I would like to have a debate in this thread about it. In my personal opinion, JavaScript IS an OOP because it is impossible to use it without objects.
-
-
Java is an OOP, but Javascript is not by default. It is possible to create and use Javascript Objects.
-
If I can, by choice, speak Russian, does that mean that I am Russian?
I think that basically summarizes the argument.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
It has strong OOP abilities with prototype support. Don't you think it is Russian, djr33?
-
-
JS has OO support. It just doesn't have classes, but classes are not requirements for OOP anyway.
Looking at wikipedia's requirements for an OOPL:
- Class: Whoever tells you this is a requirement for a language to be OO is lying. In any case, in JS, you can (and usually do) simulate classes.
- Object: Objects exist in JS.
- Method: In JS, a method is any function that is bound to an object when called.
- Message Passing: Function arguments and state changes.
- Inheritance: Prototype chain and call/apply.
- Encapsulation: Closures can be used to encapsulate, but we generally don't bother (at least with constructor functions).
- Abstraction: JS has all the wikipedia elements under Abstraction.
- Polymorphism: Duck-typing.
JS supports all of these.
Trinithis
-
-
I think DHTML, not the JavaScript itself is OOP because it is nearly impossible to do something useful with the data without objects. Alert(), the simplist task, is acually part of the window object. So is getElementById().
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks