What is implemetation difference between dojo.aspect and dojox.lang.aspect -
while implementating aspect oriented programming getting confuse why dojo having 2 differentaspect library files?
when use
dojo.aspect , dojox.lang.aspect ?
i have never heard dojox.lang.aspect
before, according git log
latest commit dates 2008.
you can find explanation why dojox.lang.aspect
exists in article author eugene lazutkin: aop aspect of javascript dojo.
while doesn't make sense in cases, should realize primary role of
dojo.connect()
process dom events.[...]
to sum up: events != aop. events cannot simulate aspects of aop, , aop cannot used in lieu of events.
so aop in javascript sounds simple! well, in reality there several sticky places:
- implementing every single advice function expensive.
- usually iterations more efficient recursive calls.
- the size of call stack limited.
- if have chained calls, it'll impossible rearrange them. if want remove 1 advice in middle, out of luck.
- the “around” advice “eat” attached “before” , “after” advices changing order of execution. cannot guarantee anymore “before” advices run before “around” advices, , on.
- usually in order decouple “around” advice original function, proceed() function used. calling result in calling next-in-chain around advice method or original method.
- our aspect object in cases want static object, in other cases want dynamic object created taking account state of object operate upon.
these , other problems resolved in dojox.lang.aspect (currently in trunk, released in dojo 1.2).
as of latest dojo 1.7, there strong tendency differentiate between events , aspects, i.e. between dojo/on
, dojo/aspect
(both implemented via dojo.connect
before).
Comments
Post a Comment