Introduction
jsClass is an extensible Javascript Base Class that enables you to do clean Object Oriented Programming (OOP) with Javascript.Why Object Oriented Programming ?
OOP is one of the multiple approaches you can take to structure your code.It doesn't fit any situation, it's proven to be an outstanding approach to handle large/complex applications.
It will help you keep your code clear, extensible, decoupled and maintainable.
For further information on OOP, just check some of the links on this article.
Extensions and Design Patterns
jsClass accepts extensions, that is, custom modifications that you can attach to classes.Some are tightly related to Design Patterns.
These are general reusable solutions to commonly occurring problems.
Each extension is very well documented on the code, specifying the different ways yo use them. Also, check the demo to see each in action.
This is the list of built-in extensions:
-
abstract
Create abstract classes that cannot be instantiated without extending. -
extend
Use inheritance, make child classes extend base classes. -
getset
Generate getters and setters for private members of your class. -
implement
Create Interfaces that define methods that need to be defined, in order to implement them. -
members
Add members to the instances of your class. It's a shortcut for SomeClass.members(...). -
module
Save your class into a Module. If required, all the namespace is created before saving the class. -
properties
Generate properties to control the access to private members of your class. -
singleton
Create Singleton classes that can only be instantiated once. -
statics
Add static methods or data to your class. It's a shortcut for SomeClass.statics(...).

5 comments:
You're doing fantastic work for jQuery. Kudos!
I love the libraries you've created. In the jsClass scripts, how do you create private variables in classes.
Hi BlueTopBrown
You can't for now. I have a nice update (RC2) on the trunk that I haven't released yet.
You normally don't worry about private vars on javascript, you simply don't document them or say they're private.
This library is wonderful!
I've a question about "extend" extension. Is it possible to extend many bases ?
Hi
No, this framework doesn't allow multiple inheritance.
It is mostly based on the Java/C# Object system.
I have a much newer version on trunk, I'll try to release it asap.
Post a Comment To get help prepare a demo.