Compose Aspect-Oriented Composition Tools for Composition Filters Lodewijk Bergmans, Istvan Nagy, Gurcan Gulesir & Mehmet Aksit: TRESE project, University of Twente
+
Sverre Boschman, Raymond Bosman, Pascal Durr, Frederik Holljen, Carlos Noguera, Tom Staijen, Christian Vinkes, ..
© 2004
Lodewijk Bergmans [
[email protected]]
Introduction About Composition Filters Goal: support and reason about robust, scalable, composition most AOP is language-specific CFs are a language-independent extension But the native type systems do not like us always.. most AOPLs allow breaking encapsulation CFs do only ‘interface programming’ this even allows for extending precompiled objects.. declarative specifications support conflict detection & verifying consistency including reasoning about semantics
© 2004
Lodewijk Bergmans [
[email protected]]
Introduction About Compose* A platform for experimentation & proof of concept but also for third parties (mostly) independent of target platform Supports multiple target languages/component models Framework supports any (mixed) approach from interpreter to inlining compiler
© 2004
Lodewijk Bergmans [
[email protected]]
Outline of this presentation
Introduction Example Application: Pacman Composition Filters in a Nutshell The Compose* tool Demonstrating some Features
© 2004
Lodewijk Bergmans [
[email protected]]
The example application: Pacman
© 2004
Lodewijk Bergmans [
[email protected]]
The Core Design
package pacman;
public abstract class Glyph // This is Java (J#) { Public Class Score private int speed = 0; // This is Visual Basicprivate int direction = 3; Private score As Integer protected int x = 0; protected int y = 0; Public Function intValue() Asint Integer protected dx = 0; Return score protected int dy = 0; End Function protected int vy = 0; protected int vx = 1; Sub increase(ByVal points As Integer) protected World world; score = score + points End Sub public Glyph(World world) World
Glyph
speed : int = 0 direction : int = 3 x : int = 0 y : int = 0 dx : int = 0 dy : int = 0 vy : int = 0 vx : int = 1
Glyph() setStartPosition() setX() setY() getX() getY() move() setDirection() getDirection() setSpeed() getSpeed() reset() update() doTurn()
screenData : short[][] MAZESIZE : int = 15
#world
World() reset() getMazeData() canMoveLeft() canMoveRight() canMoveDown() canMoveUp() canMove() moveGlyph() foodOn() vitaminOn() eatFood() eatVitamin() isEmpty()
Score
score : int = 0 intValue() increase()
Game
#world
Pacman
eviltime : long = 0 EVIL_DURATION : long = 10000 setStartPosition() setEvil() isEvil() reset() Pacman() update() doTurn()
Ghost
scared : boolean = false
#pacman
Runnable
INTRO : State = new State() PLAYING : State = new State() PAUSED : State = new State() GAMEOVER : State = new State() lives : int state : State level : int Game() setPacman() addGhost() getPacman() getGhosts() getLives() getState() play() reset() doPlaying() doPaused() doIntro() doGameover() proceed() gameInit() gameOver() gameStart() roundInit() roundOver() roundStart() getLevel()
(from l...
run()
View
BLOCKSIZE : int = 32
View() -game +view paint() paint() paint() getBuffer() clearBuffer() paintBuffer() paint() paint() run()
instantiate
{ Sub setValue(ByVal points As Integer) this.world = world; score = points this.reset(); End Sub } Ghost() setStartPosition() setScared() isScared() update() doTurn()
0..*
#ghosts
-keyboard Keyboard
End Class
© 2004
keyTyped() keyPressed() keyReleased() getNextMove() hallo() test() blaat() dus()
…
Lodewijk Bergmans [
[email protected]]
State
Main Main() main()
Composition Filters in a Nutshell
filters input~ & output~ internals & externals conditions superimposition selectors filtermodules binding
© 2004
Lodewijk Bergmans [
[email protected]]
Example Concern DynamicStrategy filtermodule dynamicstrategy { internals flee_strategy : FleeStrategy; stalk_strategy:StalkStrategy; conditions isEvil inputfilters flee_filter : Dispatch = { isEvil => flee_strategy.getNextMove }; stalk_filter : Dispatch = { True => stalk_strategy.getNextMove }; } superimposition{ selectors strategy = { *=RandomStrategy }; conditions strategy