Submit Search
Upload
Context-Oriented Programming: Beyond Layers
•
0 likes
•
419 views
E
ESUG
Follow
Context-Oriented Programming: Beyond Layers. Martin v. Löwis. ESUG 2007, Lugano
Read less
Read more
Technology
Report
Share
Report
Share
1 of 21
Download now
Download to read offline
Recommended
Reflection
Reflection
Marcus Denker
SNAPL Network Verification
SNAPL Network Verification
aurojit
Architectural patterns part 4
Architectural patterns part 4
assinha
Architectural patterns part 3
Architectural patterns part 3
assinha
Mule mel 2
Mule mel 2
kunal vishe
Active Object
Active Object
melbournepatterns
Mule mel 1
Mule mel 1
kunal vishe
Demo: Reflectivity
Demo: Reflectivity
Marcus Denker
Recommended
Reflection
Reflection
Marcus Denker
SNAPL Network Verification
SNAPL Network Verification
aurojit
Architectural patterns part 4
Architectural patterns part 4
assinha
Architectural patterns part 3
Architectural patterns part 3
assinha
Mule mel 2
Mule mel 2
kunal vishe
Active Object
Active Object
melbournepatterns
Mule mel 1
Mule mel 1
kunal vishe
Demo: Reflectivity
Demo: Reflectivity
Marcus Denker
Architectural Patterns - Interactive and Event Handling Patterns
Architectural Patterns - Interactive and Event Handling Patterns
assinha
Project Reactor By Example
Project Reactor By Example
Denny Abraham Cheriyan
Vert.x Event Driven Non Blocking Reactive Toolkit
Vert.x Event Driven Non Blocking Reactive Toolkit
Brian S. Paskin
ITFT_Inter process communication
ITFT_Inter process communication
Sneh Prabha
Active Object Design Pattern
Active Object Design Pattern
jeremiahdjordan
Multi-Process JavaScript Architectures
Multi-Process JavaScript Architectures
Mark Trostler
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project Reactor
Knoldus Inc.
Advanced Application Architecture Symfony Live Berlin 2018
Advanced Application Architecture Symfony Live Berlin 2018
Matthias Noback
Polling Techniques, Ajax, protocol Switching from Http to Websocket standard ...
Polling Techniques, Ajax, protocol Switching from Http to Websocket standard ...
Srikanth Reddy Pallerla
Design patterns
Design patterns
Ahmed Kamel Taha
Introduction to reactive programming
Introduction to reactive programming
Leapfrog Technology Inc.
Build Libraries That People Love To use
Build Libraries That People Love To use
Dennis Doomen
Reflectivity Demo
Reflectivity Demo
Marcus Denker
Reactive programming
Reactive programming
saykopatt
Reactive programming with rx java
Reactive programming with rx java
CongTrung Vnit
Vulnerability Chaining; it’s all connected
Vulnerability Chaining; it’s all connected
Toby Kohlenberg
Reactive programming and RxJS
Reactive programming and RxJS
Ravi Mone
Concurrency
Concurrency
Sri Prasanna
Reactive programming intro
Reactive programming intro
Ahmed Ehab AbdulAziz
ProMan(Project Management in python language using KIVY platform)
ProMan(Project Management in python language using KIVY platform)
manojsonkar
Aspect-oriented programming with AspectJ (as part of the the PTT lecture)
Aspect-oriented programming with AspectJ (as part of the the PTT lecture)
Ralf Laemmel
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
Ted Leung
More Related Content
What's hot
Architectural Patterns - Interactive and Event Handling Patterns
Architectural Patterns - Interactive and Event Handling Patterns
assinha
Project Reactor By Example
Project Reactor By Example
Denny Abraham Cheriyan
Vert.x Event Driven Non Blocking Reactive Toolkit
Vert.x Event Driven Non Blocking Reactive Toolkit
Brian S. Paskin
ITFT_Inter process communication
ITFT_Inter process communication
Sneh Prabha
Active Object Design Pattern
Active Object Design Pattern
jeremiahdjordan
Multi-Process JavaScript Architectures
Multi-Process JavaScript Architectures
Mark Trostler
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project Reactor
Knoldus Inc.
Advanced Application Architecture Symfony Live Berlin 2018
Advanced Application Architecture Symfony Live Berlin 2018
Matthias Noback
Polling Techniques, Ajax, protocol Switching from Http to Websocket standard ...
Polling Techniques, Ajax, protocol Switching from Http to Websocket standard ...
Srikanth Reddy Pallerla
Design patterns
Design patterns
Ahmed Kamel Taha
Introduction to reactive programming
Introduction to reactive programming
Leapfrog Technology Inc.
Build Libraries That People Love To use
Build Libraries That People Love To use
Dennis Doomen
Reflectivity Demo
Reflectivity Demo
Marcus Denker
Reactive programming
Reactive programming
saykopatt
Reactive programming with rx java
Reactive programming with rx java
CongTrung Vnit
Vulnerability Chaining; it’s all connected
Vulnerability Chaining; it’s all connected
Toby Kohlenberg
Reactive programming and RxJS
Reactive programming and RxJS
Ravi Mone
Concurrency
Concurrency
Sri Prasanna
Reactive programming intro
Reactive programming intro
Ahmed Ehab AbdulAziz
ProMan(Project Management in python language using KIVY platform)
ProMan(Project Management in python language using KIVY platform)
manojsonkar
What's hot
(20)
Architectural Patterns - Interactive and Event Handling Patterns
Architectural Patterns - Interactive and Event Handling Patterns
Project Reactor By Example
Project Reactor By Example
Vert.x Event Driven Non Blocking Reactive Toolkit
Vert.x Event Driven Non Blocking Reactive Toolkit
ITFT_Inter process communication
ITFT_Inter process communication
Active Object Design Pattern
Active Object Design Pattern
Multi-Process JavaScript Architectures
Multi-Process JavaScript Architectures
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project Reactor
Advanced Application Architecture Symfony Live Berlin 2018
Advanced Application Architecture Symfony Live Berlin 2018
Polling Techniques, Ajax, protocol Switching from Http to Websocket standard ...
Polling Techniques, Ajax, protocol Switching from Http to Websocket standard ...
Design patterns
Design patterns
Introduction to reactive programming
Introduction to reactive programming
Build Libraries That People Love To use
Build Libraries That People Love To use
Reflectivity Demo
Reflectivity Demo
Reactive programming
Reactive programming
Reactive programming with rx java
Reactive programming with rx java
Vulnerability Chaining; it’s all connected
Vulnerability Chaining; it’s all connected
Reactive programming and RxJS
Reactive programming and RxJS
Concurrency
Concurrency
Reactive programming intro
Reactive programming intro
ProMan(Project Management in python language using KIVY platform)
ProMan(Project Management in python language using KIVY platform)
Viewers also liked
Aspect-oriented programming with AspectJ (as part of the the PTT lecture)
Aspect-oriented programming with AspectJ (as part of the the PTT lecture)
Ralf Laemmel
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
Ted Leung
Aspect oriented architecture
Aspect oriented architecture
tigneb
Produce Cleaner Code with Aspect-Oriented Programming
Produce Cleaner Code with Aspect-Oriented Programming
PostSharp Technologies
Aspect Oriented Programming
Aspect Oriented Programming
Rodger Oates
Aspect-Oriented Programming
Aspect-Oriented Programming
Andrey Bratukhin
Architecture Description Languages
Architecture Description Languages
Henry Muccini
Aspect Oriented Programming
Aspect Oriented Programming
Rajesh Ganesan
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Yan Cui
Introduction to Aspect Oriented Programming
Introduction to Aspect Oriented Programming
Yan Cui
Software Architecture: Architecture Description Languages
Software Architecture: Architecture Description Languages
Henry Muccini
Aspect Oriented Programming
Aspect Oriented Programming
Anumod Kumar
Viewers also liked
(12)
Aspect-oriented programming with AspectJ (as part of the the PTT lecture)
Aspect-oriented programming with AspectJ (as part of the the PTT lecture)
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
Aspect oriented architecture
Aspect oriented architecture
Produce Cleaner Code with Aspect-Oriented Programming
Produce Cleaner Code with Aspect-Oriented Programming
Aspect Oriented Programming
Aspect Oriented Programming
Aspect-Oriented Programming
Aspect-Oriented Programming
Architecture Description Languages
Architecture Description Languages
Aspect Oriented Programming
Aspect Oriented Programming
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming
Introduction to Aspect Oriented Programming
Software Architecture: Architecture Description Languages
Software Architecture: Architecture Description Languages
Aspect Oriented Programming
Aspect Oriented Programming
Similar to Context-Oriented Programming: Beyond Layers
Mantis Code Deployment Process
Mantis Code Deployment Process
Jen Wei Lee
Open shift and docker - october,2014
Open shift and docker - october,2014
Hojoong Kim
WebDev Crash Course
WebDev Crash Course
Cesar Martinez
Orchestrating Cloud Applications With TOSCA
Orchestrating Cloud Applications With TOSCA
Arthur Berezin
Refactoring_Rosenheim_2008_Workshop
Refactoring_Rosenheim_2008_Workshop
Max Kleiner
Advanced web application architecture - Talk
Advanced web application architecture - Talk
Matthias Noback
The Meteor Framework
The Meteor Framework
Damien Magoni
Web Technology Fundamentals
Web Technology Fundamentals
sunmitraeducation
Mini-Training: NancyFX
Mini-Training: NancyFX
Betclic Everest Group Tech Team
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
Cloudera, Inc.
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
Cloudera, Inc.
Elements for an iOS Backend
Elements for an iOS Backend
Laurent Cerveau
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
vamsitricks
They why behind php frameworks
They why behind php frameworks
Kirk Madera
Server-side JS with NodeJS
Server-side JS with NodeJS
Lilia Sfaxi
Decomposing the monolith into embeddable microservices using OWIN, WebHooks, ...
Decomposing the monolith into embeddable microservices using OWIN, WebHooks, ...
Dennis Doomen
Decomposing the Monolith using Microservices that don't give you pain
Decomposing the Monolith using Microservices that don't give you pain
Dennis Doomen
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
vamsi krishna
OVS-LinuxCon 2013.pdf
OVS-LinuxCon 2013.pdf
DanielHanganu2
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
vamsitricks
Similar to Context-Oriented Programming: Beyond Layers
(20)
Mantis Code Deployment Process
Mantis Code Deployment Process
Open shift and docker - october,2014
Open shift and docker - october,2014
WebDev Crash Course
WebDev Crash Course
Orchestrating Cloud Applications With TOSCA
Orchestrating Cloud Applications With TOSCA
Refactoring_Rosenheim_2008_Workshop
Refactoring_Rosenheim_2008_Workshop
Advanced web application architecture - Talk
Advanced web application architecture - Talk
The Meteor Framework
The Meteor Framework
Web Technology Fundamentals
Web Technology Fundamentals
Mini-Training: NancyFX
Mini-Training: NancyFX
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
Elements for an iOS Backend
Elements for an iOS Backend
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
They why behind php frameworks
They why behind php frameworks
Server-side JS with NodeJS
Server-side JS with NodeJS
Decomposing the monolith into embeddable microservices using OWIN, WebHooks, ...
Decomposing the monolith into embeddable microservices using OWIN, WebHooks, ...
Decomposing the Monolith using Microservices that don't give you pain
Decomposing the Monolith using Microservices that don't give you pain
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
OVS-LinuxCon 2013.pdf
OVS-LinuxCon 2013.pdf
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
More from ESUG
Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
ESUG
Technical documentation support in Pharo
Technical documentation support in Pharo
ESUG
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
ESUG
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
ESUG
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG
Garbage Collector Tuning
Garbage Collector Tuning
ESUG
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
thisContext in the Debugger
thisContext in the Debugger
ESUG
Websockets for Fencing Score
Websockets for Fencing Score
ESUG
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ESUG
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
ESUG
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG
More from ESUG
(20)
Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
Technical documentation support in Pharo
Technical documentation support in Pharo
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
Garbage Collector Tuning
Garbage Collector Tuning
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
thisContext in the Debugger
thisContext in the Debugger
Websockets for Fencing Score
Websockets for Fencing Score
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
Recently uploaded
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
marketing932765
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
Neo4j
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
LoriGlavin3
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
Curtis Poe
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
IES VE
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
Knoldus Inc.
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
LoriGlavin3
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
UiPathCommunity
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Alkin Tezuysal
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
fnnc6jmgwh
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
Hiroshi SHIBATA
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
LoriGlavin3
A Framework for Development in the AI Age
A Framework for Development in the AI Age
Cprime
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
Farhan Tariq
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
itnewsafrica
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
Bernd Ruecker
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
Mydbops
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
LoriGlavin3
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
Nathaniel Shimoni
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
BookNet Canada
Recently uploaded
(20)
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
A Framework for Development in the AI Age
A Framework for Development in the AI Age
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Context-Oriented Programming: Beyond Layers
1.
©2007Martinv.Löwis Context-Oriented Programming: Beyond Layers Martin
v. Löwis Marcus Denker Oscar Nierstrasz
2.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Agenda • Context-dependent Behavior • Method Layers (PyContext example) • Implicit Layer Activation • Case Studies • Context Variables • Implementation Notes 2
3.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Context Dependencies • Programs need to be aware of the context in which they operate – what is the state of the environment – what user is accessing the system – what mode is the program to be executed in • Example: current user – different roles may cause completely different code to be executed (e.g. administrator may be offered different facilities) • can be modeled through method layers – different users acting in the same role access different data • modeling through method layers is not adequate • Example: dependency of program output on output device – In OO system, rendering algorithm spreads over methods of different classes 3
4.
©2007Martinv.Löwis Layers
5.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Method Layers • addition of a few concepts to object-oriented programming • layer: group of classes and methods to be used together in dynamic scope of execution • layered class: collection of partial definitions of a class, for different layers – layered methods: definitions of methods for specific layers – layered slots: definition of instance attributes for specific layers • (explicit) layer activation: specification of code block that runs in the context of a layer – inside the block, each sent message selects the method defined for that layer – nested activation: need to consider multiple layers in sequence 5
6.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Example: User-Agent Header • Web browsers sent User-Agent header to indicate client software (e.g. MSIE, Firefox, Safari, etc.) – "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" • Web servers sometimes have different behavior depending on User-Agent header • Problem: automated web client might need to claim to operate as a specific user agent 6 Client HTTP Library HTTP ServerHTTP Request User-Agent
7.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Example: User-Agent Header (2) • Assumption: client consists of multiple modules, each using different software layers to access underlying HTTP libraries – explicitly specifying User-Agent to the library is not possible • Assumption: client is multi-threaded; different threads may need to operate in different contexts – setting User-Agent as a global variable is not possible • HTTP libraries in Python: – httplib: direct access to protocol – urllib: unifying library for http, ftp, ... 7
8.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis PyContext: Using Method Layers • with statement: automatic enter/leave semantics from useragent import HTTPUserAgent with HTTPUserAgent("WebCOP"): print "Using useragent layer" get1() get2() • Importing useragent module automatically defines the layer and the layered methods • Disabling layers from layers import Disabled with Disabled(Layer): code 8
9.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Defining Layers • Inherit from class Layer – Class can have arbitrary methods, instance variables, etc class HTTPUserAgent(layers.Layer): def __init__(self, agent): self.agent = agent 9
10.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Defining Layered Methods • Inherit a class (with arbitrary name) from both the layer and the class to augment • Define methods with the same name as the original methods – Each method has automatic second parameter "context" (after self, before explicit method parameters) • Decorate each method with either before, after, or instead • Context: Object indicating the layer activation – .layer: reference to the layer object – .result: result of the original method (for after-methods) – .proceed: callable object denoting the continuation to the original method (or the next layer) 10
11.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis class HTTPConnection(HTTPUserAgent, httplib.HTTPConnection): # Always add a User-Agent header @before def endheaders(self, context): with layers.Disabled(HTTPUserAgent): self.putheader("User-Agent", context.layer.agent) # suppress other User-Agent headers added @instead def putheader(self, context, header, value): if header.lower() == 'user-agent': return return context.proceed(header, value) 11
12.
©2007Martinv.Löwis Implicit Activation
13.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Implicit Activation • Problem: explicit activation still needs to identify point in code where context might change or where context will be relevant • Objective: allow addition of layers which get activated "automatically" – specifically, when a condition on the environment changes • Design issues: – how can the system tell whether a condition becomes true? • each layer implements an active method – when should the active method be evaluated? • each time a layered method is executed whose meaning depends on whether the layer is active or not 13
14.
©2007Martinv.Löwis Case Studies
15.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Objective • We tried to evaluate what aspects of context are common in application programs today • Issue: how can we find code that depends on context? – Starting point: assume caller and callee are designed to run within the same context – Starting point: look for traditional examples of context • Selected case studies: large Python applications/libraries – Django: web application framework – Roundup: bug tracker – SCons: automated build tool 15
16.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Results • Web applications (Django, Roundup) need to support concept of "current" request, including authenticated user, session data, target URL, etc. • SCons keeps track of context in "environment": information about the current build goal • These things were often referred to as "context", or showed up as pass-through parameters in methods – Searching for "context" revealed further context-dependent code fragments – Searching for pass-through parameters not easily possible with pure text searching; subject for further study • Context information often not used to select different pieces of code, but merely as lookup keys in associative arrays 16
17.
©2007Martinv.Löwis Dynamic Variables
18.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Motivation • case study results lead to identification of additional concept for context-oriented programming: Dynamic Variables • in order to avoid pass-through parameters, a variable holding context should be set in a caller, and then read in a nested callee – similar to dynamic variables in functional languages – requires careful usage, to avoid old problems with dynamic variables (unintentional access due to naming collisions) • require explicit read and write operations 18
19.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Dynamic Variables in PyContext • Example: current HTTP session 1. Declare dynamic variable _session = Variable() 2. Obtain current variable (e.g. through helper function) def current_session(): return _session.get() 3. Setup variable from dynamically-read context def process_request(request): session = lookup_session(request) with _session.set(session): dispatch_request(request) 19
20.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Implementation Notes • Method layers: – Dynamically replace methods with wrappers • Dynamic variables: 1. perform stack walk: O(stack-depth) 2. use thread-local storage: O(1) 20
21.
Context-oriented Programming: Beyond
Layers ©2007Martinv.Löwis Summary • current applications (in particular webapps) show high degree of context-awareness • context-dependency is not made explicit in the code • layers are a first step to making context explicit • rehabilitation of dynamic variables necessary to support common cases of context 21
Download now