4 ms·
One can argue that Javascript's prototype is probably the future, not the traditional class-based OOP.
by yeukhon 13y ago
One can argue that Javascript's prototype is probably the future, not the traditional class-based OOP.
- jafaku 13y agoAre you going to say why?
- dasil003 13y agoAfter nearly 20 years of Javascript there still is no consensus on how to structure object-oriented systems. This is somewhat reminiscent of lisp's failure to succeed in the marketplace because it's so flexible that no one can agree and get behind enough core ideas to build a large ecosystem. Javascript had the weight of the web behind it to force adoption, but that clearly has been in spite of the OO model not because of it. I'm not trying to hate on JS either, I think it was a bit of a small miracle what Brendan Eich pulled off under the constraints he had and I'm thankful for JS every day. However I think it's fair to say that something like Ruby's metaclass and mixin system gives you 99% of the modeling power of advanced prototypal modeling with 99% less confusion. Obviously there are ways it could be done better and more explicitly than in Javascript's typeless object world, but even then I don't see where the win is. We need better ways to manage state and mutation in mainstream languages, not more ways to compose objects.