A
spectJS is an industrial-strength JavaScript meta-programming resource that is provided freely
by
Dodeca Technologies Ltd, and this site caters to all
facets of the product and its support. All code, documentation and related publications to be found on this and the
principal Dodeca site, were designed, developed and authored by
Richard Vaughan.
If you are unsure as to what method-call interception and aspect orientation are, and how these concepts apply to JavaScript,
then a good starting point is the article entitled
Transparency on Demand, which
is to be found on this site.
Product Overview
AspectJS allows JavaScript developers to intercept calls to a given method and, from there, cause other functions to execute as
prefixes and/or suffixes to, or 'wrappers' around, the intercepted method. For the interceptee and its callers the underlying
mechanism is entirely transparent, which leaves target code free of disjunctive logic.
This technology has a number of important applications and its small footprint makes it practical to apply intercepts in production
code, as well as during the development cycle. Critically, such functionality enables Aspect-Oriented Programming, and thereby
offers much improved, and currently unexplored approaches to professional web-development.
Note that a much improved implementation of AspectJS is in development, and will be available in September 2008. The documented
API will remain essentially unchanged, but the upgrade will deliver a considerably better product overall.
Additionally, the strict parameter-checking that the AJS object's methods perform will be 'lifted' out of that object, and will
be implemented as a 'safety harness' that developers can attach and detach at will and trivially. This will use AspectJS to
intercept its own methods with a set of argument-checking affixes, and will yield a smaller, faster and more elegant product.
Adjunct technologies will also become available with the new release.
Existing users should note that there is a known bug in the current version, in that Affix objects may promote, demote and
remove themselves and other affixes in the set of which they are a member whilst that set is being dispatched. This leads to
incorrect behaviour, and such promotions, demotions and removals will be disallowed in the new release.
Until that is available, client code should not attempt to promote, demote or remove an affix while the set of which it is a member
is being dispatched.
Capabilities
With a very few exceptions, AspectJS can intercept any method call, including:
- Global functions
- User-defined object-methods
- User-defined constructors
- Prototype functions
- Web-page event handlers
- Built-in type constructors
- Built-in type and object methods
Argument-passing to interceptees, and object-return following their execution operate normally, as do
principles such as recursion (in prefixes and suffixes, as well as in interceptees). Any exceptions thrown by the
intercepted function (and its callees) pass transparently through the interception mechanism up to the caller's scope.
Any user-defined function can serve as an affix, and multiple affixes can be applied to the same interceptee.
Different methods can act as prefixes and suffixes, or the same method can be used for both, thus wrapping the
interceptee symmetrically.
Affixes can also remain attached indefinitely, or they can be limited individually
to executing a finite number of times, whence they expire automatically. The execution-limit can also be reset,
and a given prefix or suffix can be removed explicitly if desired. AspectJS also provides detailed error-reporting
to help track problems down.
Implementation
AspectJS is implemented purely in JavaScript, and is available in two forms. The more powerful
implementation allows unlimited numbers of prefixes and suffixes to be applied to a given method, but
this range of functionality incurs certain performance and storage overheads.
The alternative form of the technology - AJS_HP - therefore trades power for efficiency, and thereby loads
faster, and delivers higher performance with lower client-storage requirements, but only allows one prefix, suffix or
wrapper to be applied to a method. The exhaustive argument-checking that the more powerful form conducts when setting
intercepts is also unavailable.
Note that neither implementation makes calls to the run-time environment, meaning that no platform-defined types or
objects are referenced. Given this, AspectJS should run on any platform that supports ECMAScript v3.0, not
just web browsers.
This Site
This site is available on www.aspectjs.com, www.aspectjs.net and www.aspectjs.co.uk, and includes:
- Product-download facilities
- A concise and comprehensive tutorial
- Complete API-documentation
- Auxiliary JavaScript libraries
- Examples of AspectJS in action
- Published articles on related issues in JavaScript
Visitors and/or users who discover bugs, factual/typographical errors, or who have enquiries, comments and other
feedback are invited to get in touch (contact details below). Alternatively, you can avail yourself
of the AspectJS discussion-forum on
AOP World.
Future Plans
Plans for AspectJS and this site include additional pages covering the product's design and associated performance
metrics, as well as further examples of its application. Further adjunct libraries will become available, and a
simple forum for discussion, debate and the exchange of ideas is also evisaged.
Additionally, there are firm plans for a book on aspect orientation in JavaScript, and users who discover novel
applications of AspectJS and/or issues that are pertinent to AOP in JavaScript are invited to submit descriptions of
their findings. Respect for, and preservation of, all intellectual property rights is guaranteed, and any original
contributions will be documented in the book. Full credit will be given to the individuals and/or organisations
concerned.
If you are an AspectJS user then you are in the vanguard of modern web development, so
why not get in touch and become an acknowledged part of this exciting new area of programming.
Contact Dodeca
Dodeca Technologies Ltd is a software development and
services company based in south-west London, and you can contact the company - specifically, Richard Vaughan - by
the following means:
Do note that any contact information that you submit will only ever be used in communication and correspondence with
you, and will not be passed on to third parties; nor will submission of such information cause you to receive
unsolicited communications.
Site Specifics
This site is best viewed in a browser that supports JavaScript and CSS (and where these features are enabled).
If such facilities are unavailable to you (or disabled, in the case of JavaScript) then you will be unable to see
the primary set of links that connect to the other pages on this site, and which should be displayed down the left-hand
side of this page. In this case, the remainder of this site can be accessed via the other link-set on this page that
constitutes the site map.
Do note that this site delivers absolutely no harmful content whatsoever, which means that it is entirely safe to
set your browser to allow 'active content' from this domain. Dodeca makes no use of proprietary technologies
such as Flash, or ActiveX, and the only dynamic code that will ever be loaded from this domain onto your machine
is pure JavaScript.
Note also that all pages on this web site are composed of valid XHTML 1.0 markup, and use valid CSS style-declarations.
However, to avoid cluttering the layout of every page, the official validation-logos are displayed only once on this
page.