What are the advantages that prototype based OO has over class based OO?

前端 未结 7 1474
借酒劲吻你
借酒劲吻你 2020-11-30 23:18

Why is class based OO so popular instead of prototype based OO? Do they teach the latter in schools? Though Javascript is prototype based, most people use it mostly function

7条回答
  •  旧巷少年郎
    2020-12-01 00:11

    I think the difference is in the power dynamic (prototyped) language gives to you. Javascript, same like LISP, gives almost unlimited power to a programmer. This power is only limited by programmer's responsibility and the level of his self-confidence. So the discussion is as old as it is - same as static typing vs. typeless. If you consider your programming power and self-discipline are strong enough - go for prototyped style.

    Paraphrasing one famous saying:

    Talent does what he can (read: class-based), genius does what he wants (read: prototype-based).

提交回复
热议问题