Scoping Changes in Self-supporting Development Environments using - - PowerPoint PPT Presentation

scoping changes in self supporting development
SMART_READER_LITE
LIVE PREVIEW

Scoping Changes in Self-supporting Development Environments using - - PowerPoint PPT Presentation

COP12, June 11, 2012 Beijing, China Scoping Changes in Self-supporting Development Environments using Context-oriented Programming Jens Lincke and Robert Hirschfeld Software Architecture Group Hasso-Plattner-Institut Potsdam


slide-1
SLIDE 1

Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Jens Lincke and Robert Hirschfeld Software Architecture Group Hasso-Plattner-Institut Potsdam www.hpi.uni-potsdam.de/swa 2012-06-11 COP’12, June 11, 2012 Beijing, China

slide-2
SLIDE 2

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Outline

  • 1. Introduction
  • 2. Self-supporting Development Environments
  • 3. Using Scoped Behavioral Adaptations for Evolving

Self-supporting Development Environments

  • 4. Examples in Webwerkstatt

– A Web-based Development Environment

  • 5. Proposed Tool Support: Capturing Changes
  • 6. Conclusion

2

slide-3
SLIDE 3

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

  • 1. Introduction
  • Interactive development in self-supporting systems

– Direct and explorative development workflow – Immediate feedback loops

  • Problem

– Changes to core behavior can lead to accidentally breaking the environment

  • Separating the tools from the objects they work on

– Avoid self-referentiality at the expense of interactivity

  • Approach

– Use context- oriented programming (COP) to separate tools from objects under development while keeping them in the same environment

3

slide-4
SLIDE 4

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

  • 2. Self-supporting Development Environments
  • Examples: Smalltalk, Self, Emacs, Squeak, and Lively Kernel

4

slide-5
SLIDE 5

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Separate Runtime Environments

  • Development tools run in a separate environment

– Work on static code – Bootstrapped by external code

  • Inter-process communication
  • vs. direct access to objects

5

slide-6
SLIDE 6

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Separate Meta-Objects

  • Tools access objects directly
  • Core parts of the system are adaptable
  • Objects are tightly coupled to a version of a class

→ New behavior only available for new instances

6

Steinert et.al 2012 Continuous Versioning

slide-7
SLIDE 7

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

  • 3. Using Scoped Behavioral Adaptations for Evolving

Self-supporting Development Environments

  • Use COP layers to adapt core classes

and methods at run-time

  • Changes affect only behavior of
  • bjects under construction

7

slide-8
SLIDE 8

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Event Counter Example

8

EventCounter = { n: 0, count: function(evt) {

  • this.n = this.n + 1;

} }

  • EventCounter.count = function(evt) {

alert("evt: " + evt); this.n = this.n + 1; }

Definition of a core object: Directly changing the object at runtime: → If tools use this count method, the system becomes unusable

slide-9
SLIDE 9

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

ContextJS

  • JavaScript language extension for

Context-oriented Programming (COP)

  • Behavioral variations for JavaScript objects
  • Implemented as a library

– Method Wrappers for layer-aware method dispatch – Partial methods

  • Open implementation for layer composition

(activeLayers…)

9

slide-10
SLIDE 10

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Organizing Changes as Layers

10

cop.create("DevLayer").refineObject(EventCounter, { count: function(evt) {

  • alert("evt: " + evt);
  • this.n = this.n + 1;

} })

Layer Definition Refining Classes (syntactic sugar in JavaScript)

cop.create("DevLayer").refineClass(TextMorph, { /* … */ } ) cop.proceed(evt);

slide-11
SLIDE 11

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Scoping Changes – Layer Activation

  • Allows for: scoping behavioral adaptations

– Global – Dynamic extent – Instance-specific and structural scoping

11

cop.withLayers([DevLayer], function() { /* … */ }) DevLayer.beGlobal(); debugArea.setWithLayers([DevLayer])

slide-12
SLIDE 12

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Merging Changes back into the Base System

12

cop.create("DevLayer").refineObject(EventCounter, count: function(evt) { if (evt.type === 'mousedown') { this.n = this.n + 1; }; } })

EventCounter = { n: 0, count: function(evt) { if (evt.type === 'mousedown') { this.n = this.n + 1; }; } } EventCounter = { n: 0, count: function(evt) { this.n = this.n + 1; } }

Code from core system Development layer New version of the core system Manual merge

cop.proceed(evt);

slide-13
SLIDE 13

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

  • 4. Examples in Webwerkstatt

– A Web-based Development Environment

14

slide-14
SLIDE 14

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Lively Webwerkstatt

  • Lively Kernel-based Wiki
  • Web-based authoring environment
  • Core idea

– Allow authors to not only change their content, but to also shape their tools as they are using them

→ Share ideas and tools directly → Self-sustaining Lively Kernel development

15

http://lively-kernel.org/webwerkstatt

slide-15
SLIDE 15

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Example 1: Visualizing Events (structural scoping)

16

slide-16
SLIDE 16

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Example 1: Visualizing Events

17

slide-17
SLIDE 17

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Example 2: Text Coloring

18

this.setWithLayers([...]) TextColorLayer.beGlobal()

slide-18
SLIDE 18

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Example 3: Developing Autocompletion

19

$morph('DevArea').setWithLayers([WordCompletionLayer]);

slide-19
SLIDE 19

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

  • 5. Proposed Tool Support: Capturing Changes

20

A

Class Browser

X

workspace

X

workspace

X

cop.createLayer("DevLayerA") .refineClass(Foo, { bar: function() { // … }, // … }) Foo.addMethods({ bar: function() { // … }, // … })

DevLayerA

function() { // … } Foo Foo2 bar bar2 bar3

DevLayerA B C

Class Syntax COP Layer Definition Syntax Layer Name Layer Name Class Names Method Names Method Body

Explicit COP usage Capturing with class syntax Capturing with tools

slide-20
SLIDE 20

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Interactive Layer Composition

21

DevLayerA DevLayerB DevLayerC

Global | ObjectA | ... select scope (de-)activate layers

slide-21
SLIDE 21

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

  • 6. Conclusion
  • Evolution of tools in self-supporting development

environments can be direct and interactive

  • Changing core parts can accidentally break the

system

  • We applied COP to self-supporting

development environments

– Organize changes into layers – Scope changes to objects of interest

→ To work safely on new features

22

slide-22
SLIDE 22

Software Architecture Group (www.hpi.uni-potsdam.de/swa) 2006-2012 Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Future Work

  • Automatic and implicit creation of layered methods
  • Merging support of layers with the base system

23

http://lively-kernel.org/webwerkstatt

slide-23
SLIDE 23

Scoping Changes in Self-supporting Development Environments using Context-oriented Programming

Jens Lincke and Robert Hirschfeld Software Architecture Group Hasso-Plattner-Institut Potsdam www.hpi.uni-potsdam.de/swa 2012-06-11 COP’12, June 11, 2012 Beijing, China