|
|
|
|
|
by goatlover
3311 days ago
|
|
Wonder how JS would have gone if it had fully embraced its prototypal nature instead of hiding it behind Java-like syntax. For as long as JS has been around, there were people clamoring for classes in the language, or thinking that it had classes, or implementing a class-like structure, until finally ES6. But it didn't have to be that way. And now the sentiment is that OOP is bad, and inheritance is evil, and classes are the worse, forcing one to predefine a taxonomy that's likely to need refactoring. But prototypal languages can be easily changed. Just change the parent slot(s), or modify the object itself, etc. |
|
Are there any codebases around 100K to 1 M lines of code written in a prototypal style, which are actually in production use?
You can claim thousands of such systems for classes. In that sense, classes are a success. That people write horrible class-based code isn't a knock against them. People also write horrible procedural code. Most code is bad. But there is some code with classes that is very good.
There was sentiment in the 90's and early 2000's that OOP is bad. I think the world has learned how to use classes since then -- e.g. no more large inheritance chains and fragile base classes. Not everything is an object -- some things are just functions, and some things are just data with no behavior.
As far as I can see, prototypes are worse along all dimensions than classes.