资 源 简 介
Summary
Despite the undisputed prominence of inheritance as the fundamental reuse mechanism in object-oriented programming languages, the main variants — single inheritance, multiple inheritance, prototype inheritance and mixin inheritance — all suffer from conceptual and practical problems. This project provides a Javascript implementation of traits, a simple compositional model for structuring object-oriented programs. A trait is essentially a group of pure methods that serves as a building block for classes and is a primitive unit of code reuse. In this model, classes are composed from a set of traits by specifying glue code that connects the traits together and accesses the necessary state.
This library (and the above paragraph) are based on the research of Nathanael Scharli, Stephane Ducasse, Oscar Nierstrasz, and Andrew P. Black. For more information on traits see the traits website or 请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报