4 ms·
JavaScript is not an object-oriented language, but a prototypical one. JS "classes" are really an attempt to use syntactic sugar to beat one concept into anothe
by dongslol 10y ago
JavaScript is not an object-oriented language, but a prototypical one. JS "classes" are really an attempt to use syntactic sugar to beat one concept into another. This is inherently ugly.
For anyone convinced they hate JS, I encourage looking through Crockford's JavaScript: The Good Parts, in which he talks about the idea mentioned above, before swearing off JS forever.
- dragonwriter 10y ago> JavaScript is not an object-oriented language, but a prototypical Prototypical languages are a subset of OO languages, despite the fact the the industrial popularity of a handful of class-based OO languages (especially C++ and it's descendants) starting in the late 1980s have made it so that many people confuse OO with specifically class-based OO.
- munificent 10y agoThe first object-oriented languages—Simula and Smalltalk—were class-based, so when "object-oriented programming" was coined, it implicitly included classes. Every OOP language had classes. Only later when Self came out was the term broadened to include languages oriented around objects without classes. Sure, we need to be more precise today and refer to "class-based object-oriented" and "prototypal object-oriented", but that's not a fault of the class-based languages. They laid claim to the general term first. Before horseless carriages, all carriages had horses, so it seems unreasonable to expect people to have presciently called them "horseful carriages" even before automobiles were invented.
- Diederich 10y agohttp://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay... "OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things." Simula has classes, but Alan Kay's "object oriented" wasn't about classes at all.
- camus2 10y ago> JavaScript is not an object-oriented language, but a prototypical one. Both Python and Ruby classes are implemented using prototypes. It doesn't make these languages less object oriented. Prototypes are an implementation detail, they have a single goal: inheritance thanks to the prototype chain. The fact is, objects are constructs that carry both behavior and state, in that sense JavaScript is capable of object oriented programming. And it has first class functions, which makes possible implementing some functional programming patterns. Therefore > JavaScript is not an object-oriented language is a false statement.