From Metaprogramming to Aspect-Oriented Programming. Éric Tanter University of Chile DCC/CWR

Size: px
Start display at page:

Download "From Metaprogramming to Aspect-Oriented Programming. Éric Tanter University of Chile DCC/CWR"

Transcription

1 From Metaprogramming to Aspect-Oriented Programming Éric Tanter University of Chile DCC/CWR

2 Outline Metaprogramming and Reflection Open Implementations Aspect-Oriented Programming

3 Metaprogramming & Reflection

4 Programs and Data Fundamental distinction appearing in 1830s Charles Babbage s Difference Engine No.2 store with data, mill with programs von Neumann architecture (1958) data and programs are stored in the same memory a program could manipulate another program as data (and even itself!) Theoretical computer science Turing machines: the universal TM (1936) Church lambda calculus: higher-order functions (1984)

5 Concepts [Maes87] data data program program world processor metasystem processor computational system (base) domain reason / act causal connection

6 Reflection Reflective system CS accessing its own metasystem Seminal work of Brian C. Smith [Smith82] 3-LISP A process integral ability to represent, operate on, and otherwise deal with itself in the the same way that it represents, operates on and deals with its primary subject matter. Pattie Maes [Maes87] study of OOP in reflective architectures

7 Reflection and Adaptation Reflection operators [FriedmanWand84] metalevel (evaluator) reification absorption base level (program) introspection: program observes its evaluator state intercession: program modifies its evaluator state

8 Structure and Behavior Structural reification implicit structures accessible as first-class entities eg. classes, methods, fields in Java Reflection API Behavioral reification implicit events of execution accessible as first-class entities eg. MethodCall object with receiver, method, args eg. creation, field access, finalization, etc., as objects

9 Reflection and OOP A Good Match reflection provides power for adaptation OOP provides structure and locality encapsulation message passing object-oriented interfaces proper decomposition incremental specialization of default implementations

10 Metaobject Protocols customized processor processor meta base implicit explicit

11 Example Simple MOP for controlling method calls class TraceMetaobject extends Metaobject { public Object handlecall(methodcall call){ print( before calling + call.getmethodname()); Object result = call.perform(); print( returning with result + result.tostring()); }} Vector v = MOP.create(Vector.class, new TraceMetaobject()); implicit protocol explicit protocol watch out the infinite recursion!

12 Example: Concurrency class Buffer { Object[] elements = new Object[MAX]; int top = 0; public Object get(){ return elements[top--]; } public void put(object o){ elements[top++] = o; } } thread safe? public synchronized Object get() throws InterruptedException { while(top == 0) wait(); Object o = elements[top--]; notifyall(); return o; } public synchronized void put(object o) throws InterruptedException { while(top == MAX) wait(); elements[top++] = o; notifyall(); } hard to write & inefficient

13 A MOP for Concurrency Sequential Object Monitors based on a MOP for controlling method calls [CMT04] call mo t1, put t2, get scheduler buffer schedule: Buffer with: BufferScheduler class BufferScheduler extends Scheduler { Buffer buf =... ; void schedule(){ if(buf.isempty()) scheduleoldest( put ); else if(buf.isfull()) scheduleoldest( get ); else scheduleoldest(); }} explicit protocol implicit protocol simple & efficient

14 Open Implementations

15 Open Implementations Reflection in the context of programming languages reify structure or execution semantics of programs Notion can be generalized implementational reflection led to open implementations

16 Implementational Reflection [Rao91] Reflection can be used to build malleable systems of all kind not only interpreters and compilers! systems also depend on other systems they use computational reflection implementational reflection reflective architecture open implementation

17 Definitions implementational reflection [Rao91] Reflection that involves inspecting and/or manipulating the implementation structures of other systems used by a program open implementation A system with an open implementation provides (at least) two linked interfaces to its clients: 1. a base-level interface to the functionality 2. a metalevel interface that reveals some aspects of how the base-level interface is implemented

18 Duality... Computational <> Implementational a language interpreter is the implementation of language the interface of any system can be seen as an interpreter for that language different characterizations of the same essential ability

19 Structure of an OI base level interface metalevel interface metalevel interface points at which base-level behavior can be customized with different semantics and/or performance causal connection is trivial MOPs = OI of interpreters [Kiczales+91] compile-time MOPs = OI of compilers [Lamping+92/Chiba95]

20 Opening Up Implementations contrary to the black-box abstraction principle!!! any realistic system implies a number of tradeoffs the higher the level is, the more tradeoffs no single fixed implementation will satisfy all users [Kiczales92] I found a large number of programs perform poorly because of the language s tendency to hide what is going on with the misguided intention of not bothering the programmer with details [Wirth74]

21 OI Classical Example A performance issue in class-based languages how are instance variables (slots) implemented? (defclass position () (x y)) many instances, both slots always used (defclass person () (name age address ...)) many instances, only few slots used in one given instance array-like representation hashtable-like representation

22 The CLOS MOP Open implementation of CLOS [Kiczales+91] (allocate-instance class) (get-value class instance slot-name) (set-value class instance slot-name new-value) (defclass hashtable-class (std-class) ()) (defmethod allocate-instance ((c hashtable-class))...allocate a hashtable to store the slots... (defmethod get-value...) (defmethod set-value...) (defclass person() (name age address ...) (:metaclass hashtable-class))

23 OI Philosophy Black-box abstraction: tricks/hacks White-box abstraction (eg. open source) no guarantee that code is well-enough structured Open implementations: reify some aspects of the implementation open up the implementation, but in a principled way [Kiczales92] explicitly focusing on the metalevel as a separate and first-class interface [...] forces a greater attention to exposing important design and implementation choices [Rao91]

24 OI Advantages Support variability in a system s implementation performance tuning semantic customization No need for direct support for rarely-needed features eg. CLOS standard: backward compatibility vs. new design support a CLOS region rather than a CLOS point

25 Open Implementations languages: CLOS [Kiczales+91] compilers [Lamping+92, Chiba95] operating systems: ApertOS [Yokote92] window systems: Silica [Rao91] reflective systems: Reflex [Tanter+01]

26 Providing OIs System [Kiczales+93] System System2... UseCase1 UseCase2... OI design: think of a range of systems which range? iterative process, feedback, refinement

27 OI Interface Styles Declarative style declare expected usage of the module [Kiczales+97a] makeset( n=5, insert=high ) + user friendly, abstract - automatic choice can be hard Strategy style choose strategy in fixed list makeset( LinkedList ) Layered style strategy + possible to provide a new strategy makeset( myset ) + precise selection - might choose badly - limited set of strategies [strategy] + open set of strategies - more complex (for both)

28 Reflection and OIs OI Interface styles as design patterns eg. Strategy for strategy and layered OI styles but explicit representation of any aspect of a system can compromise efficiency badly lazy reification for making implementation state explicit Reflection/MOPs implicit and selective reification of some aspects possibly adaptable at runtime OIs come from generalization of reflection, reflection can be used to implement OIs! [Rao91]

29 Mastering Locality Fundamental though hard to grasp many MOP architectures were locality experiments 5 coarse notions discussed in [Kiczales93+] feature textual object strategy implementation access individual features indicate what behavior to change possibly per-object basis affect individual strategy simple change simple, incrementality

30 Towards AOP Kiczales effort to understand locality led to AOP very often, the concepts that are most natural to use at the meta-level cross-cut those provided at the base level. We are, in essence, trying to find a way to provide two effective views of a system through cross-cutting localities. The structure of complex systems is such that it is natural for people to make this jump from one locality to another, and we have to find a way to support that. [Kiczales92]

31 Aspect-Oriented Programming

32 Crosscutting [Kiczales+97b] Handling crosscutting localities... Generalized-procedure languages only offer one composition mechanism: procedure call (exception handling) Requires calling site to explicitly make the call Some properties cannot be composed this way without breaking modularity

33 AOP GP language (OOP, functional, etc.) weaver application components and aspects application with tangled concerns aspect language(s)

34 Conceptual Model View a program execution as a traces of events occurring at runtime time Match aspects on event patterns Synchronize Logging

35 Aspect Languages Terminology event: join point pattern of events: pointcut code at matched events: advice Aspect languages can be general purpose (GPAL): eg. AspectJ domain specific (DSAL): eg. COOL, SOM, etc. Proper use of AOP means that users are expressing implementation strategies at an appropriately abstract level, through an appropriate aspect language, with appropriate locality. [Kiczales+97b]

36 Example Aspects aspect = modular definition of a crosscutting concern examples trace / log / monitoring GUI refresh (MVC/observer) security checks exception handling concurrency, OS scheduling distributed applications invariant checking, coding style, etc.

37 AspectJ [ First developed at Xerox PARC, now part of Eclipse & IBM Most mature AOP proposal to date AJDT for Eclipse support Model aspects as new constructs (extended Java) dynamic join points, pointcuts and advices inter-type declarations

38 AspectJ by example Autosave No instantiations in loop Caching Observer pattern

39 Autosave aspect Autosave { private int unsavedactions = 0; after() : call(* Application.save()) call(* Application.autosave()) { unsavedactions = 0; } aspect state pointcut advice kind } } after(): call(* Command.execute()) { unsavedactions++; if(unsavedactions == 5) Application.autosave(); advice body

40 No Allocations in Loop class AppThread extends Thread { void run() { while(true) {... } } } aspect NoNewInLoop { }} pointcut noalloc(): execution(* AppThread.run(..)); before(): call(* *.new(..)) && cflow(noalloc()) { System.err.println( Allocation ( + count + ) at named pct control flow + thisjoinpoint.getsourcelocation()); reified current jp

41 Caching aspect FibCaching { private HashMap cache; pointcut fibs(): execution(* Fib.calc(..)); before(): fibs() &&!cflowbelow(fibs()) { if(cache == null) cache = new HashMap(); } int around(int n): fibs() && args(n) { if(cache.containskey(n)) return cache.get(n); else { int result = proceed(); cache.put(n, result); return result; }} } non-recursive replace exec expose arg execute original

42 Caching ctd. abstract aspect Caching { private HashMap cache; abstract pointcut cached(); abstract definition before(): cached() &&!cflowbelow(cached()) {...} } } Object around(object o): cached() && args(o) { if(cache.containskey(o)) return cache.get(o); else { Object result = proceed();... } aspect FibCaching extends Caching { pointcut cached(): execution (* Fib.calc(..)); } concrete extension

43 Observer Pattern aspect Observer { private Vector Subject.observers = new Vector(); inter-type declaration } after(subject s) returning (Observer o): call(observer.new(..)){ s.observers.add(o); o.updateview(); } after(subject s): call(* Subject.update(..)) && target(s) { for(observer o : s.observers){ o.updateview(); } } expose return value expose target

44 Wormhole example: trace fib including the top-level value aspect TraceFib { pointcut fibcall(int n) : call(* Fib.calc(..)) && args(n); pointcut topcall(int n): fibcall(n) &&!cflowbelow(fibcall(int)); pointcut wormhole(int n0, int n): cflow(topcall(n0)) && fibcall(n); before(int n0, int n): wormhole(int n0, int n) { } System.out.println( Calling fib( + n + ) + for fib( + n0 + ) ;

45 Wormhole Pattern Deep in call graph, need some context information present further up normal solution: add a (useless) context parameter to all intermediate methods AOP solution: capture info in a pointcut, and introduce it in advice when needed Pattern caller space: where context info is available callee space: where context info is needed

46 Wormhole Pattern aspect WormholeAspect { pointcut callerspace(<caller context>) : <caller pointcut> ; pointcut calleespace(<callee context>) : <callee pointcut> ; pointcut wormhole(<caller context>, <callee context>): cflow(callerspace(<caller context>)) && calleespace(<callee context>) ; before(<caller context>, <callee context>): wormhole(<caller context>, <callee context>) {... }

47 Disclaimer AOP is not only for objects although it is most used in OOP today AOP is not metaprogramming/reflection although it comes from it, and can be implemented with it AOP is not AspectJ although it is the most mature Java implementation (IBM) AOP is not (only) an academic curiosity although it brings a number of unresolved challenges

48 Current Research Issues Implementation (optimization, dynamicity, etc.) More expressive aspect languages stateful aspects, trace matches, logic predicates, etc. Aspect interactions what happens when aspects affect the same event? what is the visibility of structural changes (ITDs)? Domain-specific aspect languages combining multiple approaches? ease of defining extensions/new languages?

49 Conclusions

50 Reflection & Metaprog. Powerful conceptual framework Modularize concerns at the metalevel Highly generic Excelent for system software (languages, middleware, etc.) But complex Meta viewpoint Hard to control locality Costly

51 AOP A paradigm that precisely aims at proper modularization of crosscutting concerns proper syntactic support from aspect languages Very promising high attraction in both research and industry Lots of open issues tool support standardization development process (mining, analysis, design, testing)

Course 6 7 November Adrian Iftene

Course 6 7 November Adrian Iftene Course 6 7 November 2016 Adrian Iftene adiftene@info.uaic.ro 1 Recapitulation course 5 BPMN AOP AOP Cross cutting concerns pointcuts advice AspectJ Examples In C#: NKalore 2 BPMN Elements Examples AOP

More information

New Programming Paradigms

New Programming Paradigms New Programming Paradigms Lecturer: Pánovics János (google the name for further details) Requirements: For signature: classroom work and a 15-minute presentation Exam: written exam (mainly concepts and

More information

Language support for AOP

Language support for AOP Language support for AOP AspectJ and beyond Mario Südholt www.emn.fr/sudholt INRIA and École des Mines de Nantes OBASCO project, Nantes, France Language support for AOP ; Mario Südholt; INRIA/EMN; March

More information

A Brief Introduction to Aspect-Oriented Programming" Historical View Of Languages"

A Brief Introduction to Aspect-Oriented Programming Historical View Of Languages A Brief Introduction to Aspect-Oriented Programming" Historical View Of Languages" Procedural language" Functional language" Object-Oriented language" 1 Acknowledgements" Zhenxiao Yang" Gregor Kiczales"

More information

A Brief Introduction to Aspect-Oriented Programming. Historical View Of Languages. Procedural language Functional language Object-Oriented language

A Brief Introduction to Aspect-Oriented Programming. Historical View Of Languages. Procedural language Functional language Object-Oriented language A Brief Introduction to Aspect-Oriented Programming Historical View Of Languages Procedural language Functional language Object-Oriented language 1 Acknowledgements Zhenxiao Yang Gregor Kiczales Procedural

More information

Program Transformation with Reflective and Aspect-Oriented Programming

Program Transformation with Reflective and Aspect-Oriented Programming Program Transformation with Reflective and Aspect-Oriented Programming Shigeru Chiba Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology, Japan Abstract. A meta-programming technique

More information

Language Oriented Modularity: From Theory to Practice

Language Oriented Modularity: From Theory to Practice Language Oriented Modularity: From Theory to Practice Arik Hadas Dept. of Mathematics and Computer Science The Open University of Israel Joint Work With: David H. Lorenz Language Oriented Modularity (LOM)

More information

Aspect-Oriented Programming and Aspect-J

Aspect-Oriented Programming and Aspect-J Aspect-Oriented Programming and Aspect-J TDDD05 Ola Leifer Most slides courtesy of Jens Gustafsson and Mikhail Chalabine Outline: Aspect-Oriented Programming New concepts introduced Crosscutting concern

More information

Chapitre 6 Programmation orientée aspect (AOP)

Chapitre 6 Programmation orientée aspect (AOP) 6 Programmation orientée aspect (AOP) 2I1AC3 : Génie logiciel et Patrons de conception Régis Clouard, ENSICAEN - GREYC «L'homme est le meilleur ordinateur que l'on puisse embarquer dans un engin spatial...

More information

So, What is an Aspect?

So, What is an Aspect? Introduction to AspectJ Aspect-oriented paradigm AspectJ constructs Types of Join Points Primitive Lexical designators Type designators Control flow Types of Advice Before After Around Receptions Join

More information

Bugdel: An Aspect-Oriented Debugging System

Bugdel: An Aspect-Oriented Debugging System Bugdel: An Aspect-Oriented Debugging System Yoshiyuki Usui and Shigeru Chiba Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology 2-12-1-W8-50 Ohkayama, Meguro-ku Tokyo 152-8552,

More information

AJDT: Getting started with Aspect-Oriented Programming in Eclipse

AJDT: Getting started with Aspect-Oriented Programming in Eclipse AJDT: Getting started with Aspect-Oriented Programming in Eclipse Matt Chapman IBM Java Technology Hursley, UK AJDT Committer Andy Clement IBM Java Technology Hursley, UK AJDT & AspectJ Committer Mik Kersten

More information

Meta-Program and Meta-Programming

Meta-Program and Meta-Programming Meta-Program and Meta-Programming What is a Meta-Programming? The creation of procedures and programs that automatically construct the definitions of other procedures and programs. First example the Turing

More information

Aspect Oriented Programming

Aspect Oriented Programming 1 Aspect Oriented Programming Programming Languages Seminar Presenter: Barış Aktemur University of Illinois 18 Feb. 2004 Mostly taken from Bedir Tekinerdogan s slides Outline Introduction Problems Terminology

More information

Programming AspectJ with Eclipse and AJDT, By Example. Chien-Tsun Chen Sep. 21, 2003

Programming AspectJ with Eclipse and AJDT, By Example. Chien-Tsun Chen Sep. 21, 2003 Programming AspectJ with Eclipse and AJDT, By Example Chien-Tsun Chen Sep. 21, 2003 ctchen@ctchen.idv.tw References R. Laddad, I want my AOP!, Part 1-Part3, JavaWorld, 2002. R. Laddad, AspectJ in Action,

More information

AOP Tutorial. Written By: Muhammad Asif. Department of Computer Science, Virtual University of Pakistan

AOP Tutorial. Written By: Muhammad Asif. Department of Computer Science, Virtual University of Pakistan AOP Tutorial Written By: Muhammad Asif. Department of Computer Science, Virtual University of Pakistan Table of Contents 1.0 INTRODUCTION... 3 2.0 SCOPE AND OBJECTIVE... 4 3.0 MOTIVATION... 5 4.0 HISTORY...

More information

Introduction to. Bruno Harbulot. ESNW, the University of Manchester.

Introduction to. Bruno Harbulot. ESNW, the University of Manchester. Introduction to Aspect-Oriented Software Development Bruno Harbulot ESNW, the University of Manchester http://www.cs.man.ac.uk/~harbulob/ ELF Developers' Forum Manchester - October 2005 1/24 Presentation

More information

Jarcler: Aspect-Oriented Middleware for Distributed Software in Java

Jarcler: Aspect-Oriented Middleware for Distributed Software in Java Jarcler: Aspect-Oriented Middleware for Distributed Software in Java Muga Nishizawa Shigeru Chiba Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology Email: {muga,chiba@csg.is.titech.ac.jp

More information

Inheritance (Chapter 7)

Inheritance (Chapter 7) Inheritance (Chapter 7) Prof. Dr. Wolfgang Pree Department of Computer Science University of Salzburg cs.uni-salzburg.at Inheritance the soup of the day?! Inheritance combines three aspects: inheritance

More information

OpenC: Extending C Programs with Computational Reflection

OpenC: Extending C Programs with Computational Reflection OpenC: Extending C Programs with Computational Reflection Songqing Yue * and Jeff Gray * Department of Mathematics and Computer Science, University of Central Missouri Warrensburg, Missouri 64093, USA

More information

A Model for Software Plans

A Model for Software Plans A Model for Software Plans Robert R. Painter and David Coppit Department of Computer Science The College of William and Mary private static Vector readdata() { BufferedReader stdin = new BufferedReader(

More information

JML and Aspects: The Benefits of

JML and Aspects: The Benefits of JML and Aspects: The Benefits of Instrumenting JML Features with AspectJ Henrique Rebêlo Sérgio Soares Ricardo Lima Paulo Borba Márcio Cornélio Java Modeling Language Formal specification language for

More information

Chapter 21 Aspect-Oriented Software Engineering (AOSE)

Chapter 21 Aspect-Oriented Software Engineering (AOSE) Chapter 21 Aspect-Oriented Software Engineering (AOSE) Chapter 21 Aspect-Oriented Software Engineering Slide 1 Topics covered Introduction and motivation The separation of concerns Core vs. cross-cutting

More information

Applying Aspect Oriented Programming on Security

Applying Aspect Oriented Programming on Security Original Article Applying Aspect Oriented Programming on Security Mohammad Khalid Pandit* 1, Azra Nazir 1 and Arutselvan M 2 1 Department of computer Science and engineering, National institute of technology

More information

AOSA - Betriebssystemkomponenten und der Aspektmoderatoransatz

AOSA - Betriebssystemkomponenten und der Aspektmoderatoransatz AOSA - Betriebssystemkomponenten und der Aspektmoderatoransatz Results obtained by researchers in the aspect-oriented programming are promoting the aim to export these ideas to whole software development

More information

Aspect-Oriented Programming with C++ and AspectC++

Aspect-Oriented Programming with C++ and AspectC++ Aspect-Oriented Programming with C++ and AspectC++ AOSD 2007 Tutorial University of Erlangen-Nuremberg Computer Science 4 Presenters Daniel Lohmann dl@aspectc.org University of Erlangen-Nuremberg, Germany

More information

The Art of Metaprogramming in Java. Falguni Vyas Dec 08, 2012

The Art of Metaprogramming in Java. Falguni Vyas Dec 08, 2012 The Art of Metaprogramming in Java Falguni Vyas Dec 08, 2012 Metadata What is Metadata? Data that describes other data Defined as data providing information about one or more aspects of the data, such

More information

Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008.

Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008. Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008. Outline. Abstractions for telling a computer how to do things. Computational Paradigms. Language Definition, Translation.

More information

Aspect-Oriented Programming and AspectJ

Aspect-Oriented Programming and AspectJ What is Aspect-Oriented Programming? Many possible answers: a fad Aspect-Oriented Programming and AspectJ Aspect-oriented programming is a common buzzword lately Papers from ECOOP 1997 (early overview

More information

Using Aspect-Oriented Programming to extend Protégé. Henrik Eriksson Linköping University

Using Aspect-Oriented Programming to extend Protégé. Henrik Eriksson Linköping University Using Aspect-Oriented Programming to extend Protégé Henrik Eriksson Linköping University Questions about MOP and Protégé Original goal: Extending the JessTab plug-in What is the class precedence in Protégé?

More information

CAP - Advanced Programming Concepts

CAP - Advanced Programming Concepts Coordinating unit: 270 - FIB - Barcelona School of Informatics Teaching unit: 723 - CS - Department of Computer Science Academic year: Degree: 2017 BACHELOR'S DEGREE IN INFORMATICS ENGINEERING (Syllabus

More information

Method Slots: Supporting Methods, Events, and Advices by a Single Language Construct

Method Slots: Supporting Methods, Events, and Advices by a Single Language Construct Method Slots: Supporting Methods, Events, and Advices by a Single Language Construct YungYu Zhuang and Shigeru Chiba The University of Tokyo More and more paradigms are supported by dedicated constructs

More information

Chapter 32. Aspect-Oriented Software Development (AOSD) Ian Sommerville 2006 Software Engineering. Chapter 32 Slide 1

Chapter 32. Aspect-Oriented Software Development (AOSD) Ian Sommerville 2006 Software Engineering. Chapter 32 Slide 1 Chapter 32 Aspect-Oriented Software Development (AOSD) Ian Sommerville 2006 Software Engineering. Chapter 32 Slide 1 Objectives To explain the principle of separation of concerns in software development

More information

Aspect Oriented Programming with AspectJ. Ted Leung Sauria Associates, LLC

Aspect Oriented Programming with AspectJ. Ted Leung Sauria Associates, LLC Aspect Oriented Programming with AspectJ Ted Leung Sauria Associates, LLC twl@sauria.com Overview Why do we need AOP? What is AOP AspectJ Why do we need AOP? Modular designs are not cut and dried Responsibilities

More information

Aspect-Oriented Programming

Aspect-Oriented Programming Aspect-Oriented Programming Based on the Example of AspectJ Prof. Harald Gall University of Zurich, Switzerland software evolution & architecture lab AOP is kind of a complicated one for me ( ) the idea

More information

Reflective and Adaptive Middleware

Reflective and Adaptive Middleware Advanced Distributed Systems Reflective and Adaptive Middleware MSc in Advanced Computer Science Gordon Blair (gordon@comp.lancs.ac.uk) Overview of the Session Reflective middleware: principles Background

More information

Concepts of Programming Languages

Concepts of Programming Languages Concepts of Programming Languages Lecture 1 - Introduction Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages Spring 2014

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University 9/5/6 CS Introduction to Computing II Wayne Snyder Department Boston University Today: Arrays (D and D) Methods Program structure Fields vs local variables Next time: Program structure continued: Classes

More information

Profiler Instrumentation Using Metaprogramming Techniques

Profiler Instrumentation Using Metaprogramming Techniques Profiler Instrumentation Using Metaprogramming Techniques Ritu Arora, Yu Sun, Zekai Demirezen, Jeff Gray University of Alabama at Birmingham Department of Computer and Information Sciences Birmingham,

More information

CSC 533: Organization of Programming Languages. Spring 2005

CSC 533: Organization of Programming Languages. Spring 2005 CSC 533: Organization of Programming Languages Spring 2005 Language features and issues variables & bindings data types primitive complex/structured expressions & assignments control structures subprograms

More information

Using Scala for building DSL s

Using Scala for building DSL s Using Scala for building DSL s Abhijit Sharma Innovation Lab, BMC Software 1 What is a DSL? Domain Specific Language Appropriate abstraction level for domain - uses precise concepts and semantics of domain

More information

Context-Oriented Meta-Programming

Context-Oriented Meta-Programming VRIJE UNIVERSITEIT BRUSSEL FACULTY OF SCIENCE DEPARTMENT OF COMPUTER SCIENCE Context-Oriented Meta-Programming Thesis submitted in partial fulfilment of the requirements for the degree of Licenciaat in

More information

Mobile and Context-aware Interactive Systems

Mobile and Context-aware Interactive Systems Mobile and Context-aware Interactive Systems Gaëlle Calvary Grenoble INP Laboratoire d Informatique de Grenoble (LIG) Core concepts Principles Terminology For more information, see Sara Bouchenak s M1

More information

AspectC++ An AOP Extension for C++

AspectC++ An AOP Extension for C++ AspectC++ An AOP Extension for C++ Olaf Spinczyk, Daniel Lohmann, Matthias Urban March 3, 2005 More and more software developers get in touch with aspect-oriented programming (AOP). By providing means

More information

An Aspect-Oriented Approach. Henrique Rebêlo Informatics Center

An Aspect-Oriented Approach. Henrique Rebêlo Informatics Center An Aspect-Oriented Approach to implement JML Features Henrique Rebêlo Informatics Center Federal University of Pernambuco Summary jmlc problems bigger code, slower code, no suppport for Java ME, and bad

More information

Enterprise Informatization LECTURE

Enterprise Informatization LECTURE Enterprise Informatization LECTURE Piotr Zabawa, PhD. Eng. IBM/Rational Certified Consultant e-mail: pzabawa@pk.edu.pl www: http://www.pk.edu.pl/~pzabawa/en 07.10.2011 Lecture 7 Aspect-Oriented Programming

More information

Towards a Generic Model for AOP (GEMA)

Towards a Generic Model for AOP (GEMA) Towards a Generic Model for AOP (GEMA) Katharina Mehner *, Awais Rashid Computing Department, Lancaster University, Lancaster LA1 4YR, UK mehner@upb.de, awais@comp.lancs.ac.uk Computing Department, Lancaster

More information

Frustrated by all the hype?

Frustrated by all the hype? Fundamentals of Software Architecture Looking beyond the hype Markus Völter (voelter@acm.org) Introduction Frustrated by all the hype? If so this presentation is for you. Otherwise you should leave People

More information

Synchronization SPL/2010 SPL/20 1

Synchronization SPL/2010 SPL/20 1 Synchronization 1 Overview synchronization mechanisms in modern RTEs concurrency issues places where synchronization is needed structural ways (design patterns) for exclusive access 2 Overview synchronization

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

More information

CSCI 8530 Advanced Operating Systems. Part 2 Organization of an Operating System

CSCI 8530 Advanced Operating Systems. Part 2 Organization of an Operating System CSCI 8530 Advanced Operating Systems Part 2 Organization of an Operating System What Is An Operating System? Provides abstract computing environment Supplies computational services Manages resources Hides

More information

COS 320. Compiling Techniques

COS 320. Compiling Techniques Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly

More information

CScheme in Traditional Concurrency Problems

CScheme in Traditional Concurrency Problems CScheme in Traditional Concurrency Problems Nathar Shah and Visham Cheerkoot Abstract CScheme, a concurrent programming paradigm based on scheme concept enables concurrency schemes to be constructed from

More information

Welcome to. Instructor Marc Pomplun CS 470/670. Introduction to Artificial Intelligence 1/26/2016. Spring Selectivity in Complex Scenes

Welcome to. Instructor Marc Pomplun CS 470/670. Introduction to Artificial Intelligence 1/26/2016. Spring Selectivity in Complex Scenes Welcome to CS 470/670 Introduction to Artificial Intelligence Office: Lab: Instructor Marc Pomplun S-3-171 S-3-135 Office Hours: Tuesdays 4:00pm 5:30pm Thursdays 7:00pm 8:30pm Spring 2016 Instructor: Marc

More information

DISCUSSING ASPECTS OF AOP

DISCUSSING ASPECTS OF AOP a DISCUSSING ASPECTS OF AOP How would you define AOP? Gregor Kiczales: Aspect-oriented programming is a new evolution in the line of technology for separation of concerns technology that allows design

More information

Aspect-Oriented Programming On Lisp

Aspect-Oriented Programming On Lisp 6 th International Conference on Applied Informatics Eger, Hungary, January 27 31, 2004. Aspect-Oriented Programming On Lisp Miklós Espák Department of Information Technology, University of Debrecen e-mail:

More information

Metamodeling and Metaprogramming Seminar

Metamodeling and Metaprogramming Seminar Metamodeling and Metaprogramming Seminar 1. Introduction Prof. O. Nierstrasz Spring Semester 2008 Metamodeling and Metaprogramming Seminar Lecturer: Assistant: WWW: Oscar Nierstrasz www.iam.unibe.ch/~oscar

More information

Reflective Programming and Open Implementations. Dr. Stéphane Ducasse

Reflective Programming and Open Implementations. Dr. Stéphane Ducasse Reflective Programming and Open Implementations Dr. Stéphane Ducasse ducasse@iam.unibe.ch http://www.iam.unibe.ch/~ducasse/ University of Bern 2000/2001 1. Reflective Programming and Open Implementations

More information

Linguistic Reflection Via Mirrors

Linguistic Reflection Via Mirrors Linguistic Reflection Via Mirrors Gilad Bracha Joint work with David Ungar 1 Reflection: Overview Reflection is the ability of a program to manipulate itself More than just metaprogramming Earliest Reflective

More information

Aspects and Soar: A Behavior Development Model. Jacob Crossman

Aspects and Soar: A Behavior Development Model. Jacob Crossman Aspects and Soar: A Behavior Development Model Jacob Crossman jcrossman@soartech.com Motivation: Why is Soar Useful? Soar Systems are often complex Often require multiple processes Are built of hundreds/thousands

More information

OS Customization versus OS Code Modularity

OS Customization versus OS Code Modularity OS Customization versus OS Code Modularity ECE 344 Fall 2006 Hans-Arno Jacobsen Thanks to Michael Gong, Vinod Muthusamy, and Charles Zhang for helping to find interesting examples et al. Possibly a Debugging

More information

Aspect-Oriented Generation of the API Documentation for AspectJ

Aspect-Oriented Generation of the API Documentation for AspectJ Aspect-Oriented Generation of the API Documentation for AspectJ Michihiro Horie Tokyo Institute of Technology 2-12-1 Ohkayama, Meguro-ku, Tokyo 152-8552, Japan www.csg.is.titech.ac.jp/ horie Shigeru Chiba

More information

Summary Semaphores. Passing the Baton any await statement. Synchronisation code not linked to the data

Summary Semaphores. Passing the Baton any await statement. Synchronisation code not linked to the data Lecture 4 Monitors Summary Semaphores Good news Simple, efficient, expressive Passing the Baton any await statement Bad news Low level, unstructured omit a V: deadlock omit a P: failure of mutex Synchronisation

More information

Copyright IBM Corporation 2004.All rights reserved.

Copyright IBM Corporation 2004.All rights reserved. Copyright IBM Corporation 2004.All rights reserved. http://www-106.ibm.com/developerworks/rational/library/2782.html Search help A look at aspect-oriented programming Gary Pollice Worcester Polytechnic

More information

QSOUL/Aop. Aspect Oriented Software Development using Logic Meta Programming

QSOUL/Aop. Aspect Oriented Software Development using Logic Meta Programming QSOUL/Aop Aspect Oriented Software Development using Logic Meta Programming Johan Brichau, Programming Technology Lab, Vrije Universiteit Brussel, Brussel, Belgium 7/29/10 ESUG 2001, Essen 1 Overview Aspect

More information

UNIT 3

UNIT 3 UNIT 3 Presentation Outline Sequence control with expressions Conditional Statements, Loops Exception Handling Subprogram definition and activation Simple and Recursive Subprogram Subprogram Environment

More information

Combined Object-Lambda Architectures

Combined Object-Lambda Architectures www.jquigley.com jquigley#jquigley.com Chicago Lisp April 2008 Research Goals System Goals Conventional Systems Unconventional Systems Research Goals Question: How to make with Pepsi and Coke? The Goal:

More information

RbCl: A Reective Object-Oriented Concurrent Language. without a Run-time Kernel. Yuuji Ichisugi, Satoshi Matsuoka, Akinori Yonezawa

RbCl: A Reective Object-Oriented Concurrent Language. without a Run-time Kernel. Yuuji Ichisugi, Satoshi Matsuoka, Akinori Yonezawa RbCl: A Reective Object-Oriented Concurrent Language without a Run-time Kernel Yuuji Ichisugi, Satoshi Matsuoka, Akinori Yonezawa Department of Information Science, The University of Tokyo 3 Abstract We

More information

Software Architecture

Software Architecture Software Architecture Does software architecture global design?, architect designer? Overview What is it, why bother? Architecture Design Viewpoints and view models Architectural styles Architecture asssessment

More information

Abstract. Introduction

Abstract. Introduction Aspect of Life-Cycle Control in a C++ Framework Lutz Dominick Siemens AG, Corporate Technology, ZT SE 1 D-81730 Munich, Germany Lutz.Dominick@mchp.siemens.de April 1999 Abstract This paper presents some

More information

Concepts of Programming Languages

Concepts of Programming Languages Concepts of Programming Languages Lecture 10 - Object-Oriented Programming Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages

More information

THE CONCEPT OF OBJECT

THE CONCEPT OF OBJECT THE CONCEPT OF OBJECT An object may be defined as a service center equipped with a visible part (interface) and an hidden part Operation A Operation B Operation C Service center Hidden part Visible part

More information

cs Java: lecture #6

cs Java: lecture #6 cs3101-003 Java: lecture #6 news: homework #5 due today little quiz today it s the last class! please return any textbooks you borrowed from me today s topics: interfaces recursion data structures threads

More information

Threads and Parallelism in Java

Threads and Parallelism in Java Threads and Parallelism in Java Java is one of the few main stream programming languages to explicitly provide for user-programmed parallelism in the form of threads. A Java programmer may organize a program

More information

Fun with AspectJ. 1 Getting Started. 2 Defining Pointcuts. Cleveland State University Electrical and Computer Engineering Distributed: April 8, 2008

Fun with AspectJ. 1 Getting Started. 2 Defining Pointcuts. Cleveland State University Electrical and Computer Engineering Distributed: April 8, 2008 EEC 421/521 Spring 2008 Dr. Nigamanth Sridhar Software Engineering Cleveland State University Electrical and Computer Engineering Distributed: April 8, 2008 Fun with AspectJ AspectJ is a pretty powerful

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions

More information

AOP 101: Intro to Aspect Oriented Programming. Ernest Hill

AOP 101: Intro to Aspect Oriented Programming. Ernest Hill AOP 101: Intro to Aspect Oriented Programming ernesthill@earthlink.net AOP 101-1 AOP 101: Aspect Oriented Programming Goal of Software History of Programming Methodology Remaining Problem AOP to the Rescue

More information

Programming Languages 2nd edition Tucker and Noonan"

Programming Languages 2nd edition Tucker and Noonan Programming Languages 2nd edition Tucker and Noonan" " Chapter 1" Overview" " A good programming language is a conceptual universe for thinking about programming. " " " " " " " " " " " " "A. Perlis" "

More information

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia Object Oriented Programming in Java Jaanus Pöial, PhD Tallinn, Estonia Motivation for Object Oriented Programming Decrease complexity (use layers of abstraction, interfaces, modularity,...) Reuse existing

More information

More Refactoring s: Aspect Oriented Programming with AspectJ

More Refactoring s: Aspect Oriented Programming with AspectJ More Refactoring s: Aspect Oriented Programming with AspectJ 1 Geeta Bagade, 2 Dr. Shashank Joshi 1 Ph.D. Scholar, 2 Professor/Ph.D Guide Bharati Vidyapeeth, Pune, India ABSTRACT: Even though Object Oriented

More information

Introduction to Aspect-Oriented Programming

Introduction to Aspect-Oriented Programming Introduction to Aspect-Oriented Programming Martin Giese Chalmers University of Technology Göteborg, Sweden AOP Course 2003 p.1/33 AspectJ Idioms and Patterns AOP Course 2003 p.2/33 Sources These idioms

More information

Separation of Concerns. AspectJ. What if the concerns are Cross-Cutting? SoC: Programming Paradigms. Key theme: Modularity and Encapsulation

Separation of Concerns. AspectJ. What if the concerns are Cross-Cutting? SoC: Programming Paradigms. Key theme: Modularity and Encapsulation Separation of Concerns and AspectJ EEC 625 Lecture #16 April 3, 2006 EEC 625: Software Design & Architecture Separation of Concerns Breaking a program into pieces that overlap in functionality as little

More information

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES CS-3304 Introduction In Text: Chapter 1 & 2 COURSE DESCRIPTION 2 What will you learn? Survey of programming paradigms, including representative languages Language definition and description methods Overview

More information

CS 351 Design of Large Programs Programming Abstractions

CS 351 Design of Large Programs Programming Abstractions CS 351 Design of Large Programs Programming Abstractions Brooke Chenoweth University of New Mexico Spring 2019 Searching for the Right Abstraction The language we speak relates to the way we think. The

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

Context-oriented Programming. Pascal Costanza (Vrije Universiteit Brussel, Belgium) Robert Hirschfeld (Hasso-Plattner-Institut, Potsdam, Germany)

Context-oriented Programming. Pascal Costanza (Vrije Universiteit Brussel, Belgium) Robert Hirschfeld (Hasso-Plattner-Institut, Potsdam, Germany) Context-oriented Programming Pascal Costanza (Vrije Universiteit Brussel, Belgium) Robert Hirschfeld (Hasso-Plattner-Institut, Potsdam, Germany) Programs are too static! Mobile devices Software agents

More information

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures Chapter 5: Procedural abstraction Proper procedures and function procedures Abstraction in programming enables distinction: What a program unit does How a program unit works This enables separation of

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 15: Review and Functional Programming Zheng (Eddy) Zhang Rutgers University March 19, 2018 Class Information Midterm exam forum open in Sakai. HW4 and

More information

metaxa and the Future of Reflection

metaxa and the Future of Reflection metaxa and the Future of Reflection Michael Golm, Jürgen Kleinöder University of Erlangen-Nürnberg Dept. of Computer Science 4 (Operating Systems) Martensstr. 1, D-91058 Erlangen, Germany {golm, kleinoeder}@informatik.uni-erlangen.de

More information

G Programming Languages Spring 2010 Lecture 13. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 13. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 13 Robert Grimm, New York University 1 Review Last week Exceptions 2 Outline Concurrency Discussion of Final Sources for today s lecture: PLP, 12

More information

Programming Language Pragmatics

Programming Language Pragmatics Chapter 10 :: Functional Languages Programming Language Pragmatics Michael L. Scott Historical Origins The imperative and functional models grew out of work undertaken Alan Turing, Alonzo Church, Stephen

More information

What about Object-Oriented Languages?

What about Object-Oriented Languages? What about Object-Oriented Languages? What is an OOL? A language that supports object-oriented programming How does an OOL differ from an ALL? (ALGOL-Like Language) Data-centric name scopes for values

More information

6.001 Notes: Section 17.5

6.001 Notes: Section 17.5 6.001 Notes: Section 17.5 Slide 17.5.1 Now, let's look at one example in which changing the evaluation model allows us to explore a very different kind of computational problem. Our goal is to show how

More information

Goal of lecture. Object-oriented Programming. Context of discussion. Message of lecture

Goal of lecture. Object-oriented Programming. Context of discussion. Message of lecture Goal of lecture Object-oriented Programming Understand inadequacies of class languages like Ur- Java Extend Ur-Java so it becomes an object-oriented language Implementation in SaM heap allocation of objects

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Multithreading Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to large compute clusters Can perform multiple

More information

CSCE 314 Programming Languages

CSCE 314 Programming Languages CSCE 314 Programming Languages! Reflection Dr. Hyunyoung Lee! 1 Reflection and Metaprogramming Metaprogramming: Writing (meta)programs that represent and manipulate other programs Reflection: Writing (meta)programs

More information

Using and Extending AspectJ for Separating Concerns in Parallel Java Code

Using and Extending AspectJ for Separating Concerns in Parallel Java Code Using and Extending AspectJ for Separating Concerns in Parallel Java Code Bruno Harbulot and John Gurd The University of Manchester POOSC 2005 Glasgow, July 2005 1/26 Presentation Outline Problem and Approach

More information

Outline. iterator review iterator implementation the Java foreach statement testing

Outline. iterator review iterator implementation the Java foreach statement testing Outline iterator review iterator implementation the Java foreach statement testing review: Iterator methods a Java iterator only provides two or three operations: E next(), which returns the next element,

More information

Using Aspects to Make Adaptive Object-Models Adaptable

Using Aspects to Make Adaptive Object-Models Adaptable Using Aspects to Make Adaptive Object-Models Adaptable Ayla Dantas 1, Joseph Yoder 2, Paulo Borba 1, Ralph Johnson 2 1 Software Productivity Group Informatics Center Federal University of Pernambuco Recife,

More information