Dynamic Aspect Deployment for Ruby

Overview

TwisteR is an internal AOP-DSL with dynamic deployment in Ruby. Aspects can be deployed to blocks of code. Their dynamic scope can be controlled with expressive deployment strategies. TwisteR is designed as a small core language to be extended for specific domains.

TwisteR includes also the ExploR project, a framework for test execution using non-deterministic choice.

TwisteR has been restructured and provides a meta aspect protocol since version 0.5.

Latest Release

The latest release can be downloaded here. There is no stable version yet - the release is for experimental purposes only. It is tested with Ruby version 1.9.1 and requires the external gems ruby_parser and ruby2ruby . Install on a shell with:

Accompanying Publication

Michael Achenbach and Klaus Ostermann: Growing a dynamic aspect language in Ruby. In Proceedings of the 2010 AOSD Workshop on Domain-Specific Aspect Languages, Rennes and Saint Malo, France, 2010. ACM Press. Note: The software version corresponding to this work is 0.2.0.

Usage

In its current design, the TwisteR AOP library can manipulate only user-defined code. Load TwisteR before requiring other files of the project.

Aspects are runtime objects in TwisteR. Their definition is provided as a block. After defining an aspect, the aspect must be deployed on a block of code in order to have an effect. The scope of an aspect is defined by a customizable scoping strategy, deployed together with the aspect:

require 'twister'

execution_tracing = TwisteR::BaseAspect.new do
 around pc{jp.type=='execution'} do
  puts "Tracing #{jp.name}"
  proceed
 end
end

def access x; puts "Accesssing: #{x}"; end
def delegate x; access x; end

TFX = TwisteR::Strategy.new do
 [True, False, pc{jp.name!='delegate'}]
end
TwisteR::deploy execution_tracing, TFX do
 delegate :some_resource
end