A Small Composition Language 11. Piccola. © 2003, Oscar Nierstrasz PS — Piccola 1.2  Applications = Components + Scripts  Piccola layers  Forms + Agents.

Slides:



Advertisements
Similar presentations
wwwcsif.cs.ucdavis.edu/~jacksoni
Advertisements

Slide 1 Insert your own content. Slide 2 Insert your own content.
1 Classes and Objects in Java Basics of Classes in Java.
1 Graphical User Interface (GUI) Applications Abstract Windowing Toolkit (AWT) Events Handling Applets.
© 2005 by Prentice Hall Appendix 3 Object-Oriented Analysis and Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
Chapter 7 System Models.
Copyright © 2003 Pearson Education, Inc. Slide 6-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Circuit Monitoring July 16 th 2011, OGF 32: NMC-WG Jason Zurawski, Internet2 Research Liaison.
Requirements. UC&R: Phase Compliance model –RIF must define a compliance model that will identify required/optional features Default.
MicroKernel Pattern Presented by Sahibzada Sami ud din Kashif Khurshid.
©2003 aQute, All Rights Reserved Tokyo, August 2003 : 1 OSGi Service Platform Tokyo August 28, 2003 Peter Kriens CEO aQute, OSGi Fellow
Elton Mathias and Jean Michael Legait 1 Elton Mathias, Jean Michael Legait, Denis Caromel, et al. OASIS Team INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis,
COMET Approach for UML Overview
0 - 0.
ALGEBRAIC EXPRESSIONS
Addition Facts
The ANSI/SPARC Architecture of a Database Environment
1 G54PRG Programming Lecture 1 Amadeo Ascó Adam Moore 22 GUI Programming I.
CS4026 Formal Models of Computation Running Haskell Programs – power.
Construction process lasts until coding and testing is completed consists of design and implementation reasons for this phase –analysis model is not sufficiently.
CommUnity, Tiles and Connectors joint work with Roberto Bruni José Luiz Fiadeiro Antónia Lopes Ugo Montanari Ivan Lanese Dipartimento di Informatica Università.
Connectors and Concurrency joint work with Ugo Montanari Roberto Bruni Dipartimento di Informatica Università di Pisa Dagstuhl Seminar #04241, September.
Lilian Blot 11 Spring 2014 TPOP 1. Lilian Blot 22 Spring 2014 TPOP 2.
Chapter 19 – Service-oriented Architecture
DiGIR1 DiGIR Distributed Generic Information Retrieval Stan Blum, Dave Vieglais, P.J. Schwartz.
5.9 + = 10 a)3.6 b)4.1 c)5.3 Question 1: Good Answer!! Well Done!! = 10 Question 1:
Lilian Blot PART V: FUNCTIONS Core elements Autumn 2013 TPOP 1.
Limits (Algebraic) Calculus Fall, What can we do with limits?
Executional Architecture
1 ENGLISH – LEVEL VI Week 10 – Lesson UNIT 9 – Import Export LISTENING.
Enhancing Spotfire with the Power of R
Addition 1’s to 20.
Test B, 100 Subtraction Facts
Week 1.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 31 Slide 1 Service-centric Software Engineering 1.
First BlueJ Day Houston, 2006 David J. Barnes University of Kent.
Chapter Modules CSC1310 Fall Modules Modules Modules are the highest level program organization unit, usually correspond to source files and.
Presenter: James Huang Date: Sept. 29,  HTTP and WWW  Bottle Web Framework  Request Routing  Sending Static Files  Handling HTML  HTTP Errors.
Chapter 14 The User View of Operating Systems
From Model-based to Model-driven Design of User Interfaces.
More about functions Plus a few random things. 2 Tail recursion A function is said to be tail recursive if the recursive call is the very last thing it.
Towards a Practical Composition Language Oscar Nierstrasz Software Composition Group University of Bern.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
Introduction to Software Engineering 7. Modeling Behaviour.
Component Design and Separation of Concern Designing involve: – Coming up with “application” functional components & – Integrating these functional components:
Eric MADELAINE1 E. Madelaine, Antonio Cansado, Emil Salageanu OASIS Team, INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis OSCAR meeting, Valparaiso,
6. Introduction to the Lambda Calculus. © O. Nierstrasz PS — Introduction to the Lambda Calculus 6.2 Roadmap  What is Computability? — Church’s Thesis.
Chapter 13: Process Specifications Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley, 2005.
4. Functional Programming. © O. Nierstrasz PS — Functional Programming 4.2 Roadmap  Functional vs. Imperative Programming  Pattern Matching  Referential.
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed lambda calculus.
An algebra of Connectors for modeling CommUnity with Tiles joint work with Roberto Bruni Ugo Montanari Dipartimento di Informatica Università di Pisa Ivan.
1 Outline 7.1 Introduction 7.2 Implementing a Time Abstract Data Type with a Class 7.3 Special Attributes 7.4Controlling Access to Attributes 7.4.1Get.
Comments are for people Header comments supply basic information about the artifact.
An Ontological Framework for Web Service Processes By Claus Pahl and Ronan Barrett.
Modeling Component-based Software Systems with UML 2.0 George T. Edwards Jaiganesh Balasubramanian Arvind S. Krishna Vanderbilt University Nashville, TN.
BPEL Business Process Engineering Language A technology used to build programs in SOA architecture.
12 Chapter 12: Advanced Topics in Object-Oriented Design Systems Analysis and Design in a Changing World, 3 rd Edition.
Seminar on Service Oriented Architecture Distributed Systems Architectural Models From Coulouris, 5 th Ed. SOA Seminar Coulouris 5Ed.1.
Developing Product Line Components Jan Bosch Professor of Software Engineering University of Groningen, Netherlands
Distributed Components and Futures: Models and Challenges A Distributed Component Model Distributed Reconfiguration Calculi for Components and Futures.
Architecture Description Languages (ADLs) Cf. Architecture Analysis and Design Languages.
Π-AAL: An Architecture Analysis Language for Formally Specifying and Verifying Structural and Behavioral Properties of Software Architectures Presented.
The Role of Reflection in Next Generation Middleware
SOFTWARE DESIGN AND ARCHITECTURE
CompSci 230 Software Construction
Paper written by Flavio Oquendo Presented by Ernesto Medina
Concurrent Programming Actors, SALSA, Coordination Abstractions
Learning Python 5th Edition
Lecture 2 - Names & Functions
Presentation transcript:

A Small Composition Language 11. Piccola

© 2003, Oscar Nierstrasz PS — Piccola 1.2  Applications = Components + Scripts  Piccola layers  Forms + Agents + Channels  Wrapping components  Status: semantics, types … Roadmap

© 2003, Oscar Nierstrasz PS — Piccola 1.3  Applications = Components + Scripts  Piccola layers  Forms + Agents + Channels  Wrapping components  Status: semantics, types … Roadmap

© 2003, Oscar Nierstrasz PS — Piccola 1.4 Applications = Components + Scripts Components both import and export services Scripts plug components together

© 2003, Oscar Nierstrasz PS — Piccola 1.5 Towards a Composition Language Scripting languages Configure applications from components Coordination languages Configure applications from distributed services ADLs Specify architectural styles Glue languages Adapt components

© 2003, Oscar Nierstrasz PS — Piccola 1.6  Applications = Components + Scripts  Piccola layers  Forms + Agents + Channels  Wrapping components  Status: semantics, types … Roadmap

© 2003, Oscar Nierstrasz PS — Piccola 1.7 Piccola agents compose and coordinate external components Piccola — A Small Composition Language

© 2003, Oscar Nierstrasz PS — Piccola 1.8 Piccola Layers Applications components + scripts Compositional styles streams, events, GUIs,... Standard libraries basic coordination abstractions, built-in types Piccola operator syntax, introspection, component wrappers Piccola-calculus forms, agents, channels, services

© 2003, Oscar Nierstrasz PS — Piccola 1.9  Applications = Components + Scripts  Piccola layers  Forms + Agents + Channels  Wrapping components  Status: semantics, types … Roadmap

© 2003, Oscar Nierstrasz PS — Piccola 1.10 Forms + Agents + Channels  Forms embody structure —immutable, extensible records —they unify components, services and namespaces  Agents embody behaviour —concurrently executing scripts —they unify concurrency and composition  Channels embody state —mailboxes for communicating agents —unify synchronization and communication.

© 2003, Oscar Nierstrasz PS — Piccola 1.11  A form consists of a sequence of bindings:  A script composes components by invoking services  High-level connectors hide details of object wiring. Piccola in a Nutshell helloForm =# a form text = "hello world " # a binding do : println text# a service helloForm =# a form text = "hello world " # a binding do : println text# a service makeFrame title = "AWT Demo " component = Button.new(helloForm) ? ActionPerformed helloForm.do

© 2003, Oscar Nierstrasz PS — Piccola 1.12 Hello World

© 2003, Oscar Nierstrasz PS — Piccola 1.13 Piccola Syntax Values are bound with “=”, services with “:” a = 1# binding b = (x=1, y=2)# nested binding c = (b, z=3)# extension d = c.z# projection f: a# service (no arg) println f()# application (empty form) g u: u.x + u.y# service println g(b)# application h u v: u + v# curried service println (h 1 2)# curried application a = 1# binding b = (x=1, y=2)# nested binding c = (b, z=3)# extension d = c.z# projection f: a# service (no arg) println f()# application (empty form) g u: u.x + u.y# service println g(b)# application h u v: u + v# curried service println (h 1 2)# curried application 133133 133133

© 2003, Oscar Nierstrasz PS — Piccola 1.14 Indentation Complex forms can be expressed by multiple indented lines b =# nested form x = 1 y = 2 println# invoke println with arg… g# invoke g with arg … b# argument to g y=b.x# extended with new binding b =# nested form x = 1 y = 2 println# invoke println with arg… g# invoke g with arg … b# argument to g y=b.x# extended with new binding Cf. Haskell and Python 22 22

© 2003, Oscar Nierstrasz PS — Piccola 1.15 Fixpoints Recursive services and forms are specified with the def keyword def fib n:# naïve fibonacci if n<=2 then: 1 else: fib(n-1) + fib(n-2) def fib n:# naïve fibonacci if n<=2 then: 1 else: fib(n-1) + fib(n-2) Note that if is a curried service …

© 2003, Oscar Nierstrasz PS — Piccola 1.16 Control structures  Control structures are defined as standard Piccola services if bool cases: 'cases=(then:(),else:(),cases) bool.select(true=cases.then, false=cases.else)() if bool cases: 'cases=(then:(),else:(),cases) bool.select(true=cases.then, false=cases.else)()

© 2003, Oscar Nierstrasz PS — Piccola 1.17 Local bindings and defaults Bindings are made private with the ' operator Defaults are defined by extension if bool cases: 'default =# define defaults then:() else:() 'cases = (default, cases)# set defaults 'doit = bool.select# select service true = cases.then false = cases.else doit()# invoke it if bool cases: 'default =# define defaults then:() else:() 'cases = (default, cases)# set defaults 'doit = bool.select# select service true = cases.then false = cases.else doit()# invoke it

© 2003, Oscar Nierstrasz PS — Piccola 1.18 Agents and Channels You can start a concurrent agent by invoking run, passing it a form with a do service. A channel is a mailbox for communicating with agents: run do: … # do something time-consuming run do: … # do something time-consuming c = newChannel()# create a channel run (do: println c.receive())# start an agent c.send("hello!")# send it a message c = newChannel()# create a channel run (do: println c.receive())# start an agent c.send("hello!")# send it a message  hello!

© 2003, Oscar Nierstrasz PS — Piccola 1.19 Infix and prefix operators Services may be defined as infix or prefix operators: newVar X: 'c = newChannel() 'c.send(X) *_: 'val=c.receive() 'c.send(val) val _<-_ X: 'val=c.receive() 'c.send(X) X newVar X: 'c = newChannel() 'c.send(X) *_: 'val=c.receive() 'c.send(val) val _<-_ X: 'val=c.receive() 'c.send(X) X x = newVar(1) println (*x)  1 println (x<-2)  2 x = newVar(1) println (*x)  1 println (x<-2)  2 NB: Without agents and channels, Piccola is purely functional

© 2003, Oscar Nierstrasz PS — Piccola 1.20 Example: Futures Agents and channels can be used to define common coordination abstractions, like futures, semaphores, readers/writers synchronization policies and so on … A “future” is a ticket for a value that is still being computed: future task: 'result = newChannel() 'run(do: result.send(task.do())) result.receive future task: 'result = newChannel() 'run(do: result.send(task.do())) result.receive f12 = future(do: fib(12)) println f12()  144 f12 = future(do: fib(12)) println f12()  144

© 2003, Oscar Nierstrasz PS — Piccola 1.21 Explicit namespaces Everything is a form, including the current namespace, known as root. Is just sugar for: 'x=1 root=(root,x=1)

© 2003, Oscar Nierstrasz PS — Piccola 1.22 Reflection Piccola provides various built-in services to inspect and manipulate forms countLabels f: 'count = newVar(0) 'forEachLabel# a standard service form = f do L: count <- 1 + *count *count countLabels f: 'count = newVar(0) 'forEachLabel# a standard service form = f do L: count <- 1 + *count *count println (countLabels root)  75 println (countLabels root)  75

© 2003, Oscar Nierstrasz PS — Piccola 1.23  Applications = Components + Scripts  Piccola layers  Forms + Agents + Channels  Wrapping components  Status: semantics, types … Roadmap

© 2003, Oscar Nierstrasz PS — Piccola 1.24 Language bridging Piccola does not provide booleans, numbers or strings — instead, these are forms that wrap Host language objects as components —Host objects are automatically wrapped as forms when imported to Piccola, and unwrapped when Host services are invoked —Special wrappers may be registered to adapt the interfaces of selected components

© 2003, Oscar Nierstrasz PS — Piccola 1.25 Wrapping AWT components Java AWT Frames are automatically wrapped to add a ? connector: def wrapComponent X:... _?_ aHandler aClosure:... wrapper.frame X: wrapComponent X... registerWrapper "java.awt.Frame" wrapper.frame def wrapComponent X:... _?_ aHandler aClosure:... wrapper.frame X: wrapComponent X... registerWrapper "java.awt.Frame" wrapper.frame

© 2003, Oscar Nierstrasz PS — Piccola 1.26  Applications = Components + Scripts  Piccola layers  Forms + Agents + Channels  Wrapping components  Status: semantics, types … Roadmap

© 2003, Oscar Nierstrasz PS — Piccola 1.27 Other features  Module system based on explicit namespaces  Anonymous services (lambdas)  Dynamic scoping on demand  A simple testing framework  Lists, Sets and Maps

© 2003, Oscar Nierstrasz PS — Piccola 1.28 Piccola Semantics The semantics of Piccola is defined using a process calculus with first-class namespaces

© 2003, Oscar Nierstrasz PS — Piccola 1.29 How forms support composition

© 2003, Oscar Nierstrasz PS — Piccola 1.30 Results so far  Piccola implementations for Java and Squeak —Sophisticated language bridging —Efficient partial evaluation —Various experimental composition styles  Formal semantics —π calculus with first-class namespaces —Limited reasoning about styles and composition  Publications and software:

© 2003, Oscar Nierstrasz PS — Piccola 1.31  Explicit components, connectors & styles  Type-checking provided and required services  Reasoning about styles and compositions  Adapting/reengineering existing services What’s missing?

© 2003, Oscar Nierstrasz PS — Piccola 1.32  Dynamic composition of ubiquitous services  Service discovery and negotiation  Reconfiguration validation and run-time monitoring  New, fine-grained models of components, composition and evolution  Component models for mobile, pervasive and embedded systems The future of composition?

© 2003, Oscar Nierstrasz PS — Piccola 1.33 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. 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.