Thoughts about how to adopt the principles of Aspect Oriented Programming to JavaScripts dynamic and functional nature.
View the Project on GitHub petsel/javascript-method-modification
Thoughts about how to adopt the principles of Aspect Oriented Programming to JavaScripts dynamic and functional nature.
AOP inspired method modifiers like Function.prototype[before|after|around]
Traits and
Mixins with implementations that introduce concurring methods, resolving conflicts can be handled
easier by such modifiers.
Basic Modifiers vs True AO Systems
Pure Method Modifying ...
Thoughts about how to adopt the principles of AOP to JavaScripts dynamic and functional nature.
around, before,
after, afterThrowing, afterReturning, as kind of a minimal AOP influenced
base set that already supports library (framework) agnostic modification of function based control flow by just
wrapping additional behaviors (advice handlers) around existing methods(functions).
clarify role of Joinpoint, Pointcut, Advice and Aspect;
especially from this point of view of what makes them distinct from existing approaches in compiled and/or non
dynamic and/or non functional programming languages.
no need of a pointcut specific language but methods as filters in order to define pointcuts that access/collect joinpoints.
maybe support for accumulating joinpoints in a way similar to a pointcut's definition by just providing a filter method.
maybe even consider dropping the AOP paradigm of supporting an "oblivious" system thus allowing to
mark/flag methods as joinpoints from within any JavaScript source code - think in ways of e.g. Function.prototype.(un)markJoinpoint.
Joinpoint in JavaScript always needs to feature both a method that is bound to an object and
this very object itself (regardless of either this couple is locally scoped or not). One might even think about
a label that optionally gets assigned to a joinpoint.
Pointcut in JavaScript always should be able to return a collection of joinpoints that are
filtered according to certain criteria.
Advice in JavaScript always should feature both a method that defines behavior (or could be
seen as advice handler) and a named qualifier or type e.g. before, after,
around(, afterReturning, afterThrowing).
Aspect in JavaScript needs to feature just a sole function that enables folding of advices and
pointcuts within it's function body.
confirm
or deny.
add or remove joinpoints, pointcuts, advices regardless of how many aspects are
currently confirmed or denied.
off and on again.