Metamodeling and Metaprogramming Seminar 1. Introduction Prof. O. Nierstrasz Spring Semester 2008.

Slides:



Advertisements
Similar presentations
Profiles Construction Eclipse ECESIS Project Construction of Complex UML Profiles UPM ETSI Telecomunicación Ciudad Universitaria s/n Madrid 28040,
Advertisements

8. Static Single Assignment Form Marcus Denker. © Marcus Denker SSA Roadmap  Static Single Assignment Form (SSA)  Converting to SSA Form  Examples.
8. Introduction to Denotational Semantics. © O. Nierstrasz PS — Denotational Semantics 8.2 Roadmap Overview:  Syntax and Semantics  Semantics of Expressions.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
12. Common Errors, a few Puzzles. © O. Nierstrasz P2 — Common Errors, a few Puzzles 12.2 Common Errors, a few Puzzles Sources  Cay Horstmann, Computing.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Load-time structural reflection in Java – Shigeru Chiba, 2000 May 27, 2004 Shimin.
ESE Einführung in Software Engineering 6. Modeling Objects and Classes Prof. O. Nierstrasz.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
Introduction to Software Engineering 7. Modeling Behaviour.
OORPT Object-Oriented Reengineering Patterns and Techniques 7. Problem Detection Prof. O. Nierstrasz.
10. Petri Nets Prof. O. Nierstrasz. Roadmap  Definition: —places, transitions, inputs, outputs —firing enabled transitions  Modelling: —concurrency.
Object-Oriented Reengineering Patterns and Techniques Prof. O. Nierstrasz Prof. S. Ducasse T.
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
19/02/2004 Slide 1 Internal Presentation by : Sergio Maffioletti Pervasive and Artificial Intelligenge research group On : « The.
8. Introduction to Denotational Semantics. © O. Nierstrasz PS — Denotational Semantics 8.2 Roadmap  Syntax and Semantics  Semantics of Expressions 
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
ESE Einführung in Software Engineering N. XXX Prof. O. Nierstrasz Fall Semester 2009.
© Oscar Nierstrasz ST — Smalltalk Basics 2.1 Change sets  Make sure your changes are logged to a new change set.
The Software Composition Group Prof. O. Nierstrasz
13. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Summary, Trends, Research...  Summary: functional, logic and object-oriented.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed lambda calculus.
13. A bit of Smalltalk. © Oscar Nierstrasz 2 Roadmap  The origins of Smalltalk  What is Smalltalk?  Syntax in a nutshell  Seaside — web development.
CP — Concurrent Programming 12. Petri Nets Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Metamodeling Seminar X. CHAPTER Prof. O. Nierstrasz Spring Semester 2008.
© S. Demeyer, S. Ducasse, O, Nierstrasz Tools.1 10(b). Tool Integration Why Integrate Tools? Which Tools to Integrate? Tool Integration Issues The “Help.
© Oscar Nierstrasz ST — Smalltalk Basics 2.1 Change sets  Make sure your changes are logged to a new change set.
UML CASE Tool. ABSTRACT Domain analysis enables identifying families of applications and capturing their terminology in order to assist and guide system.
Ontologies Reasoning Components Agents Simulations An Overview of Model-Driven Engineering and Architecture Jacques Robin.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Data and Process Modeling
N. XXX Prof. O. Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap Overview  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed.
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
ESE Einführung in Software Engineering 6. Modeling Objects and Classes Prof. O. Nierstrasz.
Whole Platform Tesi di Dottorato di: RICCARDO SOLMI Università degli Studi di Bologna Facoltà di scienze matematiche, fisiche e naturali Corso di Dottorato.
10. The PyPy translation tool chain Toon Verwaest Thanks to Carl Friedrich Bolz for his kind permission to reuse and adapt his notes.
© S. Demeyer, S. Ducasse, O. Nierstrasz Chapter.1 MakeMoney Corp. C*O of MakeMoney Corp. Our Vision  We invest in software  We do not know software 
OORPT Object-Oriented Reengineering Patterns and Techniques X. CHAPTER Prof. O. Nierstrasz.
CP — Concurrent Programming X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
12. eToys. © O. Nierstrasz PS — eToys 12.2 Denotational Semantics Overview:  … References:  …
CSE 590DB: Database Seminar Autumn 2002: Meta Data Management Phil Bernstein Microsoft Research.
Spectra Software Defined Radio Products Applying Model Driven Design, Generative Programming, and Agile Software Techniques to the SDR Domain OOPSLA '05.
A novel approach to modeling Zvezdan Protić, Tom Verhoeff, Mark van den Brand.
Executable UML The Models are the Code - Executable UML CS387 Paul Krause.
Workshop on Integrated Application of Formal Languages, Geneva J.Fischer Mappings, Use of MOF for Language Families Joachim Fischer Workshop on.
7. Just In Time Compilation Prof. O. Nierstrasz Jan Kurs.
MDE Model Driven Engineering Xavier Blanc Université Pierre et Marie Curie
Introduction to MDA (Model Driven Architecture) CYT.
Building Tools by Model Transformations in Eclipse Oskars Vilitis, Audris Kalnins, Edgars Celms, Elina Kalnina, Agris Sostaks, Janis Barzdins Institute.
What is MOF? The Meta Object Facility (MOF) specification provides a set of CORBA interfaces that can be used to define and manipulate a set of interoperable.
Copyright © 2009 AtlanMod. All Rights Reserved Frédéric Jouault & Hugo Bruneliere AtlanMod team (INRIA & Mines de Nantes) Possible Benefits of Bridging.
August/2007 Helton Souza Lima SBCARS 1 Automatic Generation of Platform Independent Built-in Contract Testers Helton Souza Lima Franklin Ramalho Patricia.
ModelPedia Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites Centro de Informática – CIn/UFPe ORCAS Group Eclipse GMF Fábio M. Pereira.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
OBJECT ORIENTED AND FUNCTION ORIENTED DESIGN 1 Chapter 6.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Jim Dowling, DSG. Introduction to Reflection1 Reflection and the Metaobject Protocol paradigm by Jim Dowling.
CSCE 314 Programming Languages Reflection Dr. Hyunyoung Lee 1.
About the Author A Lifetime of Software Development Started Writing Code at Age 11 Programming Summer Camp at Age 12 Writing Code Ever Since At Age 25,
CP — Concurrent Programming 6. Liveness and Guarded Methods Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Concepts and Experiments in Computational Reflection Pattie Maes.
Institutional Repositories July 2007 Intellectual property management : the DISA experience Dr D Peters DISA: Digital Innovation South Africa.
Yu, et al.’s “A Model-Driven Development Framework for Enterprise Web Services” In proceedings of the 10 th IEEE Intl Enterprise Distributed Object Computing.
Ontologies Reasoning Components Agents Simulations An Overview of Model-Driven Engineering and Architecture Jacques Robin.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Chapter 5 – System Modeling Lecture 1 1Chapter 5 System modeling.
Methodology Overview 2 basics in user studies Lecture /slide deck produced by Saul Greenberg, University of Calgary, Canada Notice: some material in this.
Evaluating Compuware OptimalJ as an MDA tool
Software Architecture & Design
Presentation transcript:

Metamodeling and Metaprogramming Seminar 1. Introduction Prof. O. Nierstrasz Spring Semester 2008

© Oscar Nierstrasz 1. Introduction 1.2 Metamodeling and Metaprogramming Seminar Lecturer: Oscar Nierstrasz Assistant: David Röthlisberger WWW: scg.unibe.ch/Teaching/MM

© Oscar Nierstrasz 1. Introduction 1.3 Roadmap  Goals of this seminar  Seminar topics  Historical perspective

© Oscar Nierstrasz 1. Introduction 1.4 Roadmap  Goals of this seminar  Seminar topics  Historical perspective

© Oscar Nierstrasz 1. Introduction 1.5 Goals Learn about:  Models and metamodels  Metaprogramming  Reflection: —introspection and intercession —structural and behavioural reflection Get experience with:  Reflective programming languages  Manipulating models at runtime  Modern model-driven technology  Researching a topic and presenting it (in English!)

© Oscar Nierstrasz 1. Introduction 1.6 Roadmap  Goals of this seminar  Seminar topics  Historical perspective

© Oscar Nierstrasz 1. Introduction 1.7 Planned lecture topics  FAME (AA+TV)  Traversals (AA)  Magritte (LR)  Geppetto and sub-method reflection (MD)  … I.e., lectures that we will do.

© Oscar Nierstrasz 1. Introduction 1.8 Seminar topics (suggestions)  UML OCL (TV)  MDE Case Study (ON, TV)  Business Rule Modeling (OG)  Transformation Languages (LR)  DSLs (TG, LR)  CLOS Metaprogramming (TV)  AOP (OG)  Business Process Modeling (AA)  EMF / eCore in eclipse (AA)  GMF (Graphical Modeling Framework) (LR)  Template Metaprogramming (ON)  Naked Objects (ON)  Self (ON)  … I.e., seminars that you will prepare!

© Oscar Nierstrasz 1. Introduction 1.9 Deliverables  Presentation —Talk —Cheat Sheet  Demo —Presentation —Quick Start  Draft exam questions Your final grade will be based 50% on your seminar plus 50% on the final exam (all topics).

© Oscar Nierstrasz 1. Introduction 1.10 Roadmap  Goals of this seminar  Seminar topics  Historical perspective —What is a model? A meta-model? —Reflection and reification —Reflection in programming languages —Model-driven engineering

© Oscar Nierstrasz 1. Introduction 1.11 Roadmap  Goals of this seminar  Seminar topics  Historical perspective —What is a model? A meta-model? —Reflection and reification —Reflection in programming languages —Model-driven engineering

© Oscar Nierstrasz 1. Introduction 1.12 What is a model? This slide intentionally left blank  Description/abstraction of real world things  Something with a meta description of how it should be structured  Objects & relationships (a graph?)  What’s a supermodel?  Composition of models — cars & traffic  Could be abstraction of something imaginary  For reasoning  Abstract representation that can be manipulated by a program  Can be easier to modify or work with  Simulation (cost)  Abstraction of a process  Abstraction of something that does not exist yet

© Oscar Nierstrasz 1. Introduction 1.13 What is a meta-model? This slide intentionally left blank

© Oscar Nierstrasz 1. Introduction 1.14 Example from databases Model System Meta-model Meta-meta-modelRelational data model: Tables, attributes, tuples Database schema: Student, Course, Enrolment … Database tables of tuples: (andreas, muster, ), … Real world: You, MMS, … «represented-by» «instance-of»

© Oscar Nierstrasz 1. Introduction 1.15 Programming is Modeling Programs are models … so they should look and behave like models!

© Oscar Nierstrasz 1. Introduction 1.16 Roadmap  Goals of this seminar  Seminar topics  Historical perspective —What is a model? A meta-model? —Reflection and reification —Reflection in programming languages —Model-driven engineering

© Oscar Nierstrasz 1. Introduction 1.17 Metaprogramming  A metaprogram is a program that manipulates a program (possibly itself)

© Oscar Nierstrasz 1. Introduction 1.18 Reflection  “Reflection is the ability of a program to manipulate as data something representing the state of the program during its own execution. —Introspection is the ability for a program to observe and therefore reason about its own state. —Intercession is the ability for a program to modify its own execution state or alter its own interpretation or meaning. Both aspects require a mechanism for encoding execution state as data: this is called reification.” —Bobrow, Gabriel & White, “CLOS in Context”, 1993

© Oscar Nierstrasz 1. Introduction 1.19 Why we need reflection “As a programming language becomes higher and higher level, its implementation in terms of underlying machine involves more and more tradeoffs, on the part of the implementor, about what cases to optimize at the expense of what other cases. … the ability to cleanly integrate something outside of the language’s scope becomes more and more limited” Kiczales, in Paepcke 1993

© Oscar Nierstrasz 1. Introduction 1.20 Reflection and Reification Metamodel Model Object Object class anObject «instance of» «reification» «introspection» (reflection) «intercession» (reflection) «modification»

© Oscar Nierstrasz 1. Introduction 1.21 Causal connection  “A system having itself as application domain and that is causally connected with this domain can be qualified as a reflective system” —Maes, OOPSLA 1987 —A reflective system has an internal representation of itself. —A reflective system is able to act on itself with the ensurance that its representation will be causally connected (up to date). —A reflective system has some static capacity of self- representation and dynamic self-modification in constant synchronization

© Oscar Nierstrasz 1. Introduction 1.22 Roadmap  Goals of this seminar  Seminar topics  Historical perspective —What is a model? A meta-model? —Reflection and reification —Reflection in programming languages —Model-driven engineering

© Oscar Nierstrasz 1. Introduction 1.23 Reflection in programming languages  Assembler  Lisp  Scheme  Smalltalk  CLOS  Java  C++  Generative programming

© Oscar Nierstrasz 1. Introduction 1.24 Structural and behavioral reflection  Structural reflection lets you reify and reflect on —the program currently executed —its abstract data types.  Behavioral reflection lets you reify and reflect on —the language semantics and implementation (processor) —the data and implementation of the run-time system. Malenfant et al., A Tutorial on Behavioral Reflection and its Implementation, 1996

© Oscar Nierstrasz 1. Introduction 1.25 Introspection in Java // Without introspection World world = new World(); world.hello(); // With introspection Class cls = Class.forName("World"); Method method = cls.getMethod("hello", null); method.invoke(cls.newInstance(), null);

© Oscar Nierstrasz 1. Introduction 1.26 Reflection in Smalltalk

© Oscar Nierstrasz 1. Introduction 1.27 Meta Programming in Programming Languages  The meta-language and the language can be different: —Scheme and an OO language  The meta-language and the language can be same: —Smalltalk, CLOS —In such a case this is a metacircular architecture

© Oscar Nierstrasz 1. Introduction 1.28 Three approaches 1. Tower of meta-circular interpreters 2. Reflective languages 3. Open implementation

© Oscar Nierstrasz 1. Introduction Tower of meta-circular interpreters  Each level interprets and controls the next —3-Lisp, Scheme  “Turtles all the way down” [up] —In practice, levels are reified on-demand

© Oscar Nierstrasz 1. Introduction Reflective languages  Meta-entities control base entities —Smalltalk, Self —Language is written in itself

© Oscar Nierstrasz 1. Introduction Open implementation  Meta-object protocols provide an interface to access and modify the implementation and semantics of a language —CLOS  More efficient, less expressive than infinite towers

© Oscar Nierstrasz 1. Introduction 1.32 Roadmap  Goals of this seminar  Seminar topics  Historical perspective —What is a model? A meta-model? —Reflection and reification —Reflection in programming languages —Model-driven engineering

© Oscar Nierstrasz 1. Introduction 1.33 Models and metamodels in software  Databases  Model-driven engineering (MDE/MDA)  XML  Domain specific languages  Round-trip engineering

© Oscar Nierstrasz 1. Introduction 1.34 M1M1 M2M2 M3M3 MDA in a nutshell - One unique Metametamodel (the MOF) - An important library of compatible Metamodels, each defining a DSL - Each of the models is defined in the language of its unique metamodel

© Oscar Nierstrasz 1. Introduction 1.35 The OMG/MDA Stack the UML MetaModel ClassAttribute * 1 a UML Model Client Name : String M2M2 M1M1 the MOF Class Association source destination M3M3 c2     metamodel model "the real world" meta-meta model The MOF The UML metamodel ++ Some UML Models ++ Various usages of these models M0M0 M1M1 M2M2 M3M3  

© Oscar Nierstrasz 1. Introduction 1.36 The Vision of MDA software developer Platform Independent Model automatic translation

© Oscar Nierstrasz 1. Introduction 1.37 PyPy — model-driven language implementation

© Oscar Nierstrasz 1. Introduction 1.38 What you should know!  What is the relationship between a model and its meta-model?  How is a meta-model also a model?  What is the difference between descriptive and prescriptive models?  Do we need meta-meta-models?  How is programming like modeling?  What is the difference between introspection and intercession?  What is reification and what is it for?  What is the difference between structural and behavioural reflection?  What are M0, M1, M2 and M3 in MDA?

© Oscar Nierstrasz 1. Introduction 1.39 Can you answer these questions?  What kind of reflection does Java support? C++?  What would it mean to turn Pascal into a reflective language?  What exactly is “meta-circular” about a “meta-circular architecture” mean?  In practice, how would you implement a programming language as an infinite tower of meta-circular interpreters?  What are M1, M2 and M3 in relational databases?  When does MDA/MDE pay off in practice?

© Oscar Nierstrasz 1. Introduction 1.40 License > Attribution-ShareAlike 2.5 You are free: to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above.