Has anyone used JS.Class and liked it?

后端 未结 2 2119
耶瑟儿~
耶瑟儿~ 2021-02-20 11:45

Has anyone used JS.Class and liked it? I \'ve used Joose before and find it really good in creating clean code that is very readable and maintainable. Any real life stories ab

相关标签:
2条回答
  • 2021-02-20 12:02

    Sorry for the first-person answer here, but although I have not used JS.Class, from a Java/Javascript developer standpoint, it looks very good. Our team works on a Java project with most of our front end using home-brewed JavaScript (and not a small amount of it). We don't use any JS frameworks (jQuery didn't exist when our project started) and we've even implemented our own drag and drop/sort utilities that make extensive use of inheritance.

    For convenience and for the ability to use inheritance, (and through much evolution) we ended up developing methods that come to nearly the exact same patterns as JS.Class (but not nearly as extensive).

    Everything I read in the docs on classes and modules, inheritance, etc. seemed very natural — in fact, it looks like we could probably replace all of our class-creation methods (a method we called objectLib.createClass) with new JS.Class with no other changes to make.

    We also ended up developing our own Set classes and other array and object utilities that JS.Class includes as part of it's core functionality.

    So, while I can't say that I've used JS.Class and liked it, I can say that as a Javascript developer I have needed to solve nearly the exact problems that JS.Class appears to solve very well.

    0 讨论(0)
  • 2021-02-20 12:15

    I have not used it and I do not personally find a good use for the classical inheritance pattern so far in my experience. I switched to Javascript programming from Java to run away from all those design patterns!

    You may also (if you haven't already) take a look at these posts from Douglas Crockford on what he thinks of classical inheritance in javascript.

    http://www.crockford.com/javascript/inheritance.html

    http://javascript.crockford.com/prototypal.html

    0 讨论(0)
提交回复
热议问题