Documentation 2.x
Version 2.x
dcl
is a micro library written in JavaScript for node.js and modern browsers that implements OOP with mixins + AOP at both “class” and object level.
Its repository is hosted at https://github.com/uhop/dcl – version 2.x branch is called dev2x
.
Getting started
- Installation - super-simple ways to install
dcl
- Tutorial - hands-on with
dcl
- Cheatsheet - look up common operations
- ChangeLog - an official record of changes
Module documentation
- dcl.js -
dcl
kernel that includes chaining control and AOP support- dcl.superCall() - super call decorator
- dcl.advise() - general advice decorator, includes useful shortcuts:
- dcl.before() - “before” advice decorator
- dcl.after() - “after” advice decorator
- dcl.around() - “around” advice decorator
- chaining directives:
- dcl.chainBefore() - “before” chaining directive
- dcl.chainAfter() - “after” chaining directive
- property directive:
- dcl.prop() - custom property decorator, useful for getters/setters
- advise.js - object-level AOP with dynamic advisement
- advise() - general advice directive, includes useful shortcuts:
- advise.before() - “before” advice decorator
- advise.after() - “after” advice decorator
- advise.around() - “around” advice decorator
- advise() - general advice directive, includes useful shortcuts:
- debug.js - error-checking and introspection facility
- dcl.log() - log information of classes and objects
Library documentation
dcl
comes with a small library of useful advices, mixins, and base classes:
- Advices - various debugging, cache, and AOP helpers
- Bases - constructor helpers
- Mixins - life-cycle helpers
- Utils - utilities
Advanced topics
- Decorator - explains the concept of decorators, and how they are used in
dcl
- Supercalls in JS - discussion of different methods to do supercalls in JavaScript,
their pros and cons, and what was selected for
dcl
and why - Constructors - desigining robust mixin-aware constructors
- Multi-stage construction - implementing multi-stage construction
- Destructors - destructing objects and freeing its resources is a serious business
- OOP and JS - discussion of advanced OOP, its deficiencies, and ways to overcome its problems
- OOP in JS slides - my presentation at ClubAjax partially based on the blog post above;
dcl
was introduced as an experiment to create a balanced OOP + AOP package, which helps leverage mixin-based techniques