About
A minimalistic yet complete JavaScript package for node.js and browsers. It implements OOP with mixins + AOP at both “class” and object level.
The goal of dcl
is to provide a sound OOP/AOP foundation for
projects of all sizes, while promoting the best practices to
keep user’s codebase small and DRY.
It is a tool to structure a project as a set of small orthogonal mixins glued together with supercalls, chaining, and advices leading to reducing the overall codebase, and clear path to refactor the resulting project.
It is started by Eugene Lazutkin, and publicly available on GitHub.
Overview
- Works in node.js and browsers (both AMD, and globals).
- Fully compatible with strict mode.
- Small codebase.
- Easy to learn, easy to use.
- Intentionally small set of orthogonal features.
- Extensively tested.
- Uses continuous integration running >150 automated tests.
- Liberally licensed.
- Legally clean code.
- Developed in the open.
- All contributions are covered by CLA.
Highlights
- Targets OOP with mixins technology.
- Supports a Python-like multiple inheritance (implements the same C3 MRO algorithm).
- Efficient supercalls — no run-time penalty, ultimate debuggability.
- Automatic constructor chaining, and you can specify chaining for any method.
- Full support for AOP (before, around, after returning, and
after throwing advices).
- AOP can be applied at “class” level (statically) or at object level (dynamically).
- Dynamic advices can be unadvised at any time.
- Comes with a mini library of useful generic building blocks.
Stress on debuggability
The package was written with debuggability of your code in mind. It comes with a special debug module that verifies created objects, explains mistakes, and helps to keep track of AOP advices.
Because dcl
uses direct static calls to super methods, you don’t need
to step over unnecessary stubs. In places where stubs are unavoidable
(chains or advices) they are small, and intuitive.
Installation
1
|
|
1
|
|
You can find more details and instructions in Installation guide 2.x (for 1.x version – Installation guide 1.x).
Happy coding!