declarative layer composition in framework based
play

Declarative Layer Composition in Framework-based Environments Malte - PowerPoint PPT Presentation

Declarative Layer Composition in Framework-based Environments Malte Appeltauer, Robert Hirschfeld Software Architecture Group Hasso-Plattner-Institute University of Potsdam Run-time Adaptation in Context-oriented Programming layer layer


  1. Declarative Layer Composition in Framework-based Environments Malte Appeltauer, Robert Hirschfeld Software Architecture Group Hasso-Plattner-Institute University of Potsdam

  2. Run-time Adaptation in Context-oriented Programming layer layer composition layer composition control flow Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  3. Problems Framework User Code layer layer composition layer composition layer composition composition ■ access to framework code prohibited ■ adaptation in third-party code requires deep knowledge ■ distracting from domain-related work control flow Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  4. Layer Composition can be a Crosscutting Concern Framework layer composition layer composition layer composition User Code layer composition layer composition Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  5. Crosscutting Concerns ■ code □ homogeneous □ heterogeneous ■ adaptation ■ adaptation □ static / compile-time □ dynamic / run-time Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  6. Crosscutting Concerns: Context-oriented Programming ■ code Decomposition Runtime □ homogeneous Classes □ heterogeneous ■ adaptation ■ adaptation C □ static / compile-time □ dynamic / run-time Layers Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  7. Crosscutting Concerns: Aspect-oriented Programming ■ code □ homogeneous □ heterogeneous ■ adaptation ■ adaptation □ static / compile-time □ dynamic / run-time Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  8. Extending COP to New Application Domains ■ graphical user interfaces ■ mobile platforms ■ distributed systems [ASH11] ■ context-based applications ■ context-based applications [AH08, AHR08] [Appeltauer10] [AHM09, AHH+10, AHM+10] [RAL+11] Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  9. A GUI-based Computer Game ■ action adventure computer game □ graphical user interface framework □ user-controlled character □ interaction with other entities □ interaction with other entities ■ heterogeneous crosscutting concerns □ confused character behavior □ graphics zooming □ development mode Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  10. A GUI-based Computer Game Object-oriented Decomposition KeyboardListener EntityUI Entity GameWindow Character Region ImageProvider AiCharacter Hero World RegionUI WorldUI Knight Princess Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  11. A GUI-based Computer Game Character Behavior KeyboardListener EntityUI Entity GameWindow Character Region ImageProvider AiCharacter Hero World RegionUI WorldUI Knight Princess Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  12. A GUI-based Computer Game Character Behavior if (hero.isConfused()) { with (ConfusedHeroLayer) { … Framework } } hero confused? then compose layer hero confused? KeyboardListener then compose layer EntityUI EntityUI Entity Entity GameWindow Character Region ImageProvider AiCharacter Hero World RegionUI WorldUI Knight Princess hero confused? then compose layer hero confused? then compose layer control flow Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  13. A GUI-based Computer Game Character Behavior Framework hero confused? then compose layer hero confused? KeyboardListener then compose layer layer composition may be a EntityUI EntityUI Entity Entity • meta-level • homogeneous GameWindow Character Region crosscutting concern ImageProvider � meta-level � � � AiCharacter Hero World RegionUI WorldUI aspect-oriented programming Knight Princess hero confused? then compose layer hero confused? then compose layer control flow Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  14. The JCop Programming Language Decomposition Runtime Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  15. The JCop Programming Language ■ Java language extension □ based on ContextJ ■ explicit language constructs for ■ explicit language constructs for □ layers □ partial methods □ explicit layer activation □ context classes Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  16. The JCop Programming Language Context Class ■ meta-level aspect ■ encapsulates layer composition public contextclass MagicBottleContext { public contextclass MagicBottleContext { private Bottle bottle; private Layer confusedBehavior = new ConfusedHero(); public DrinkingContext(Bottle bottle) { this.bottle = bottle; } public boolean heroDrunkTheBottle() { return bottle.isEmpty(); } when (heroDrunkTheBottle()) : with (confusedBehavior); } pointcut composition advice Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  17. The JCop Programming Language Evaluation ContextJ-based refactoring to JCop-based implementations JCop implementations Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  18. The JCop Programming Language Evaluation Case Studies Project Size COP-based JCop-based (User Code) Layer Composition Layer Composition tangled tangled implementation implementation classes classes • 33 Classes RetroAdventure 15 with • 3 Layers 30% 3 context classes Computer Game statements • 3000 LoC CJEdit CJEdit • 40 Classes • 40 Classes 13 with GUI-based • 6 Layers 13% 2 context classes statements Text Editor • 3500 LoC MyBook • 30 Classes 10 with 1 context class, SOA-based • 6 Layers 24% 0% statements JCop/SOA Library Web Shop • 4500 LoC AstroPic • 9 Classes 3 with Mobile Device • 2 Layers 33% 1 context class statements Image Gallery • 320 LoC WhenToDo • 25 Classes 1 context class, 18 with Context-based • 2 Layers 24% Context Query statements ToDoApplication • 1500 LoC Library Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

  19. Summary ■ COP for framework-based environments □ layer composition may be a crosscutting concern □ redundant composition statements ■ using the JCop programming language □ integration of a meta-level aspect language for layer composition □ additional layer composition features (static, reflective, object-specific, implicit) ■ case study-based evaluation □ applications that use inversion of control □ mobile, event-based, service-oriented, context management systems Declarative Layer Composition in Framework-based Environment, COP'12, 2012-06, M. Appeltauer

Recommend


More recommend