University of British Columbia Software Practices Lab Presentation Techniques for more Expressive Programs Andrew Eisenberg PhD Oral Defense.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

The C ++ Language BY Shery khan. The C++ Language Bjarne Stroupstrup, the language’s creator C++ was designed to provide Simula’s facilities for program.
Semantic Analysis Chapter 6. Two Flavors  Static (done during compile time) –C –Ada  Dynamic (done during run time) –LISP –Smalltalk  Optimization.
CS18000: Problem Solving and Object-Oriented Programming.
CS324e - Elements of Graphics and Visualization A Little Java A Little Python.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
University of British Columbia Software Practices Lab Expressive Programs Through Presentation Extension Andrew D. Eisenberg and Gregor Kiczales.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
AIXM Viewer Implementation Presentation to AIXM Users’ Conference, Federal Aviation Administration, Washington D.C., Feb 27-March 1, By: Mark Austin,
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Intro to Java Programming  A computer follows the instruction precisely and exactly.  Anything has to be declared and defined before it can be used.
A First Program Using C#
The Center for Advanced Research In Software Engineering (ARISE) The University of Texas at Austin Reengineering of Large-Scale Polylingual Systems Mark.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
Programming Languages
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
CS 355 – Programming Languages
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
1 Beyond Annotations: A Proposal for Extensible Java (XJ) Tony Clark, Thames Valley University Paul Sammut, HSBC James Willans, Ceteva
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Lesson 11 CDT301 – Compiler Theory, Spring 2011 Teacher: Linus Källberg.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005, Chapter 11: Compiler II: Code Generation slide 1www.idc.ac.il/tecs.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
A Little Language for Surveys: Constructing an Internal DSL in Ruby H. Conrad Cunningham Computer and Information Science University of Mississippi.
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
Inheritance CSI 1101 Nour El Kadri. OOP  We have seen that object-oriented programming (OOP) helps organizing and maintaining large software systems.
Object Oriented Software Development 4. C# data types, objects and references.
Interfaces An interface is like an extreme case of an abstract class – However, an interface is not a class – It is a type that can be satisfied by any.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Creating a Java Application and Applet
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Requirement Engineering with URN: Integrating Goals and Scenarios Jean-François Roy Thesis Defense February 16, 2007.
POLYMORPHISM Chapter 6. Chapter Polymorphism  Polymorphism concept  Abstract classes and methods  Method overriding  Concrete sub classes and.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
An Interface Mechanism for Encapsulating Weaving in Class-based AOP
Concepts of Programming Languages
Working with Java.
Inheritance ITI1121 Nour El Kadri.
Web Services-JAX-RPC JAX-RPC enables a Web Service endpoint to be developed using either a Java Servlet or Enterprise JavaBeans (EJB) component model.
CS 326 Programming Languages, Concepts and Implementation
C# and the .NET Framework
C Basics.
CS360 Windows Programming
Implementing Language Extensions with Model Transformations
Java Applets.
A GUI Based Aid for Generation of Code-Frameworks of TMOs
Focus of the Course Object-Oriented Software Development
Implementing Language Extensions with Model Transformations
An Overview of C.
Distributed System using Web Services
Instructor: Alexander Stoytchev
Presentation transcript:

University of British Columbia Software Practices Lab Presentation Techniques for more Expressive Programs Andrew Eisenberg PhD Oral Defense

2 Brett is a programmer I need the mean of a bunch of integers

3 The program Brett intends to write

4 The program in Java public double mean(List x) { int sum = 0; for (int i : x) { sum += i; } return sum / x.size(); }

5 Ducky is a programmer public double mean(List x) { int sum = 0; for (int i : x) { sum += i; } return sum / x.size(); } What does this mean?

6 Another Program

7 What does this mean? Intended Meaning Perceived Meaning

8 Expressive programs An expressive program is one where its perceived meaning reliably aligns with its intended meaning. public double mean(List x) { int sum = 0; for (int i : x) { sum += i; } return sum / x.size(); }

9 Expressiveness Many things affect a program’s expressiveness –language features –abstraction techniques –naming conventions …and… – presentation

10 Using presentation for more expressive programs Need a different kind of editor Is this feasible? Architecture? Capabilities? Kinds of programs?

11 Thesis statement Program editors that can present programs using a non-surjective relationship to the concrete syntax enable a set of presentation techniques that are natural alternatives to existing language design, editor design, and programming best-practices techniques. Careful use of these presentation techniques appears to lead to more expressive programs.

12 Argument structure 1. Architecture (is feasible) 2. Presentation Techniques 3. Various Editor and language properties 4. Higher Level ideas 5. More Expressive Enables Establish Express When aligned with intended meaning

13 1. Architecture (is feasible) 2. Presentation Techniques 3. Various Editor and language properties 4. Higher Level ideas 5. More Expressive Enables Establish Express When aligned with intended meaning

14 Architecture is Feasible Composable Presentation Editor Architecture Two implementations –ETMOP (Edit time metaobject protocol) Open, extensible editor Presentation extensions –Embedded CAL Closed, domain specific editor Embeds a small language in a host language Developed at Business Objects Now part of CAL open source distribution

private int private int y; Edit time Metaobject protocol (ETMOP) editor provides editing semantics Compile time Metobject protocol (CTMOP) provides private int x; public int getX() { return x; } public void setX(int x) { this.x = x; private int y; public int getY() { return y; } public void setY(int y) { this.y = y; } Presentation Extensions

16 Equation Editing

17 1. Architecture (is feasible) 2. Presentation Techniques 3. Various Editor and language properties 4. Higher Level ideas 5. More Expressive Enables Establish Express When aligned with intended meaning

18 Presentation Techniques Spatial arrangement Textual manipulation Temporal referencing Graphical enhancements Constrained editing void changesAdvice(Point p){ Screen.logDistanceFromOrigin(p); && execution(void Point.set*(int))") void changes(Point p){}

19 Architecture enables Presentation techniques Example:

20 Parse & Apply private int private int y; Program AST + Metadata Metadata is shared between field private int private int y;

21 Logical Layout Program AST + Metadata Logical private int private int y;

22 Physical Layout Program AST + Metadata Logical private int private int y; Physical Layout

23 Source ↔ Presentation Program AST + Metadata Logical private int private int y; Physical Layout “ get ” gets shunted around allows spatial arrangement (other presentation techniques as well)

24 1. Architecture (is feasible) 2. Presentation Techniques 3. Various Editor and language properties 4. Higher Level ideas 5. More Expressive Enables Establish Express When aligned with intended meaning

25 Establish editor & language properties Abstraction in computer programs –Polymorphism –Inheritance –Functional abstraction … – Graphical enhancements Example: Defining webservices

26 Webservices are verbose public class HelloService { public String sayHello(String username) { return "Hello "+username+"!!!"; } public String sayHelloDocument(String username) { System.out.println(username+" said hello!!!"); } RPC over internet Implementation (Java) WSDL service descriptor (XML)

27

28 Java annotations as abstraction mechanism JSR 181 –specification –defines Webservices as annotations in Java code –pre-processor converts to name="HelloWebService", targetNamespace= use=SOAPBinding.Use.LITERAL) public class public String String username) { return "Hello @SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL) public String String username) { System.out.println(username+" said hello!!!"); } Webservice concern is tangled with Java concern Presentation techniques provide alternative abstraction mechanism

29 Graphical Abstraction

30 Abstraction: Metadata vs. targetNamespace= " use=SOAPBinding.Use.LITERAL) public class public String String username) { return "Hello @SOAPBinding(style= SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL) public String String username) { System.out.println(username + " said hello!!!"); } Metadata: all text Graphical: Java implementation is clear icons emphasize structure stored form is text

31 1. Architecture (is feasible) 2. Presentation Techniques 3. Various Editor and language properties 4. Higher Level ideas 5. More Expressive Enables Establish Express When aligned with intended meaning

32 Ideas are expressed What is the perceived meaning of this program?

33 This is a Java class… I see icons that indicate a Webservice Perceived meaning This is likely to be a Java class that implements a webservice.

34 1. Architecture (is feasible) 2. Presentation Techniques 3. Various Editor and language properties 4. Higher Level ideas 5. More Expressive Enables Establish Express When aligned with intended meaning

35 More expressive Recall: An expressive program is one in which the perceived meaning reliably aligns with the intended meaning.

targetNamespace= " use=SOAPBinding.Use.LITERAL) public class public String String username) { return "Hello @SOAPBinding(style= SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL) public String String username) { System.out.println(username + " said hello!!!"); } Intended meaning This is a Java class that implements a Webservice Intended and Perceived meanings align a bit I can see webservice annotations, but it is hard to read the Java implementation

37 Intended meaning Intended and Perceived meanings align  More expressive This is a program about Java class that implements a Webservice

38 Alternative Presentation (Mockup) This is a program about Java class that implements a Webservice

39 Intended and Perceived meanings do not align  Alternative Perceived Meaning This looks like a webservice Less expressive I can see the structure of the Webservice But how is it implemented? This is a program about Java class that implements a Webservice

40 Perceived meaning Intended and Perceived meanings do not align  This is likely to be a Java class that implements a webservice. X Less expressive

41 Summary of claims Editors that enable a set of presentation techniques are feasible to implement. –Architecture & two implementations These presentation techniques are alternatives to standard programming language and editor techniques. –Graphical abstraction Proper use of these techniques make programs more expressive. –Presenting webservices

42 Open Questions Are these presentations useful? –feasibility of implementing editors –properties of programs –user study Definition of expressiveness –qualitative, not quantitative –does not allow absolute analysis –can be used comparatively

43 Related Work Editor architectures –Traditional (Emacs, vi) –Hard structure Cornell Program Synthesizer [Teitelbaum 81] Interlisp-D [Barstow 81] –Soft structure (Eclipse, Visual Studio, NetBeans) –Display-oriented DrScheme [Findler 97] MPS [Dmitriev 04] Domain Workbench [Simonyi 06] Smalltalk [Goldberg 83] Expressiveness through language extension –Syntax Macros [Leavenworth 66] –Attribute grammars [Kennedy 76] –Syntactic stylesheets [Edwards 05] –Metaobject protocols [Kiczales 91] Expressiveness through Multi-lingual programming –Embedding syntax [Bravenboer 04] –Common runtime environments [Meijer 00] –Pipelines [Garlan 93] –Service-oriented architecture [Newcomer 04]

44 Related Work Editor architectures –Traditional (Emacs, vi) –Soft structure (Eclipse, Visual Studio, NetBeans) Language extension mechanisms

45 Soft-structure editors Bijection Surjection package ca.ubc.ships; public class Ship { private int x; private int y; public int getX() { return x; } public int getY() { return y; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; }

46 Composable Presentation editors Can copy, rearrange, remove elements private int private int y;

47 Related Work Editor architectures –Traditional (Emacs, vi) –Soft structure (Eclipse, Visual Studio, NetBeans) –Display-driven DrScheme [Findler 97] MPS [Dmitriev 04] Domain Workbench [Simonyi 06] Language extension mechanisms –Syntax Macros [Leavenworth 66] –Syntactic Stylesheets [Edwards 05]

48 Contributions Composable presentation editor architecture Set of presentation techniques Qualitative framework for evaluating expressiveness of programs Analysis of how presentation techniques compare to other kinds of techniques ETMOP-CTMOP –open, extensible editor & semantic processor –set of examples Embedded CAL –closed, domain specific editor

49 1. Architecture (is feasible) 2. Presentation Techniques 3. Various Editor and language properties 4. Higher Level ideas 5. More Expressive Enables Establish Express When aligned with intended meaning Thank you!

50 Extra Material

51 Temporal Referencing Sum of constants must be 100

52 Life cycles in jEdit

53 Services in jEdit

54 HandlesMessage in jEdit

55 Quasiquote in Java

56 Graphics establish scoping Finite automaton

57 Architecture

58 Embedded CAL Architecture

59 Embedded CAL Embed CAL in Java using editor technology CAL Lazy functional language Statically typed Haskell-like semantics Java byte-code

60 Embedded CAL

61 Embedded CAL (expanded)

62