Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone used JS.Class and liked it?

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 about JS.Class?

like image 493
DLS Avatar asked Feb 24 '10 19:02

DLS


2 Answers

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.

like image 90
Nicole Avatar answered Oct 17 '22 17:10

Nicole


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

like image 43
Chetan S Avatar answered Oct 17 '22 18:10

Chetan S