Core.JS' Core.extend()
method provides the capability to define new classes, extending either a subclass of your choosing or JavaScript's built-in Object
class by default.
The most important benefit of Core.extend()
is that it provides the ability to use class-based inheritance rather than prototype-based inheritance. It uses the Shared Prototype approach, to avoid inheriting the state of a prototype instance of the base class. Additionally it provides the capability to declare methods as abstract, and also to declare properties as either virtual (can be overridden) or final (can not be overridden). The later capability enables us to define pseudo-private methods and instance variables in JavaScript classes. And finally, code written with Core.extend()
is easier to read (and thus more maintainable) than comparable code written without it.