Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School...

52
Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    213
  • download

    0

Transcript of Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School...

Page 1: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Jiazzi: New-Age Components for Old-Fashioned Java

Sean McDirmid

Matthew Flatt

Wilson C. Hsieh

School of ComputingUniversity of Utah

Page 2: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Java Components

Not all components are objects Components should share classes

ApplicationUser

InterfaceLibrary

Page 3: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

External Linking

ApplicationUser

InterfaceLibrary

Page 4: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

External Linking

ApplicationUser

InterfaceLibrary

InterposedService

Page 5: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Separate Compilation

Application

cl ass Wi dget {…}cl ass But t on ext ends Wi dget {…}cl ass Wi ndow {…}

cl ass Appl i cat i on { st at i c voi d mai n( ) { b = new But t on( ) ; w = new Wi ndow( ) ; w. add( b) ; w. show( ) ; }}

Page 6: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Separate Compilation

ApplicationUser

InterfaceLibrary

cl ass Appl i cat i on { st at i c voi d mai n( ) { b = new But t on( ) ; w = new Wi ndow( ) ; w. add( b) ; w. show( ) ; }}

Page 7: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Separate Compilation

ApplicationUser

InterfaceLibrary

cl ass Appl i cat i on { st at i c voi d mai n( ) { b = new But t on( ) ; w = new Wi ndow( ) ; w. add( b) ; w. show( ) ; }}

Page 8: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Separate Compilation

ApplicationUser

InterfaceLibrary

Page 9: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Separate Compilation

ApplicationUser

InterfaceLibrary

Page 10: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Separate Compilation

LinkedApplication

ApplicationUser

InterfaceLibrary

Page 11: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Jiazzi Components

cl ass AppWi ndow ext ends …{ voi d r un( ) {…} voi d i ni t ( ) {…}}

Page 12: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Imports

in Widget Window

cl ass AppWi ndow ext ends …{ voi d r un( ) {…} voi d i ni t ( ) {…}}

Page 13: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Imports

in Widget Window

cl ass AppWi ndow ext ends i n. Wi ndow{ voi d r un( ) {…} voi d i ni t ( ) {…}}

Page 14: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Exports

in Widget Window

ou

t

cl ass AppWi ndow ext ends i n. Wi ndow{ voi d r un( ) {…} voi d i ni t ( ) {…}}

AppWindow

Page 15: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Signatures

in Widget Window

ou

t

cl ass AppWi ndow ext ends i n. Wi ndow{ voi d r un( ) {…} voi d i ni t ( ) {…}}

AppWindow

Page 16: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Signatures

in

Widgetpaint

Windowshow

ou

t

cl ass AppWi ndow ext ends i n. Wi ndow{ voi d r un( ) {…} voi d i ni t ( ) {…}}

AppWindowrun

Page 17: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Linking

in

Widgetpaint

Windowshow

ou

t

ou

t

cl ass AppWi ndow ext ends i n. Wi ndow{ voi d r un( ) {…} voi d i ni t ( ) {…}}

Widgetpaint

Windowshow

AppWindowrun

Page 18: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Linking

in

Widgetpaint

Windowshow

ou

t

ou

t

cl ass AppWi ndow ext ends i n. Wi ndow{ voi d r un( ) {…} voi d i ni t ( ) {…}}

Widgetpaint

Windowshow

AppWindowrun

Page 19: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Re-exports

in

Widgetpaint

Windowshow

ou

t

ou

t

ou

t

cl ass AppWi ndow ext ends i n. Wi ndow{ voi d r un( ) {…} voi d i ni t ( ) {…}}

Widgetpaint

Windowshow

AppWindowrun

AppWindowrun

Page 20: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Re-exports

in

Widgetpaint

Windowshow

ou

t

ou

t

ou

t

cl ass AppWi ndow ext ends i n. Wi ndow{ voi d r un( ) {…} voi d i ni t ( ) {…}}

Widgetpaint

Windowshow

AppWindowrun

AppWindowrun

Page 21: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Outline

Jiazzi: components for Java Demonstration of expressiveness Key features of Jiazzi

Page 22: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

An Extensibility Problem

Widgetpaint

ButtonsetLabel

Page 23: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

An Extensibility Problem

Widgetpaint

ButtonsetLabel

Page 24: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

An Extensibility Problem

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

Page 25: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

An Extensibility Problem

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

Page 26: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

An Extensibility Problem

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

Page 27: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

An Extensibility Problem

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

Page 28: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

An Extensibility Problem

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

Page 29: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

An Extensibility Problem

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

Page 30: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

A Solution

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

Page 31: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

A Solution

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

FontWidgetsetFont

FontButton

Page 32: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

A Solution

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

FontWidgetsetFont

FontButton

Page 33: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

A Solution

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

FontWidgetsetFont

FontButton

Page 34: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

Widgetpaint

ButtonsetLabel

ColorWidgetsetColor

ColorButton

FontWidgetsetFont

FontButton

Page 35: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

Widgetpaint

ButtonsetLabel

WidgetsetColor

Button

WidgetsetFont

Button

Page 36: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

WidgetsetColor

Button

Widgetpaint

ButtonsetLabel

WidgetsetFont

Button

Page 37: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

in

Widgetpaint

ButtonsetLabel

WidgetsetColor

Button

ou

t Widgetpaint

ButtonsetLabel

WidgetsetFont

Button

WidgetsetColor

Button

WidgetsetFont

Button

Page 38: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Button

ou

t Widgetpaint

ButtonsetLabel

in

Widgetpaint

ButtonsetLabel

WidgetsetFont

Button

Page 39: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Button

ou

t Widgetpaint

ButtonsetLabel

fix

ed Widget in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetFont

Button

Button

Page 40: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Button

ou

t Widgetpaint

ButtonsetLabel

fix

ed Widget in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetFont

Button

Button

Page 41: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Buttonfi

xed Widget Button

ou

t Widgetpaint

ButtonsetLabel

fix

ed Widget Button in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetFont

Button

fix

ed Widget Button

Page 42: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Buttonfi

xed Widget Button

ou

t Widgetpaint

ButtonsetLabel

fix

ed Widget Button

Page 43: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern o

ut Widget

paintButton

setLabel

fix

ed Widget Button in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetFont

Button

fix

ed Widget Button

Page 44: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Open Class Pattern o

ut Widget

paintButton

setLabel

fix

ed Widget Button

Page 45: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Outline

Jiazzi: components for Java Demonstration of expressiveness Key features of Jiazzi

Page 46: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Cyclic Component Linking

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Buttonfi

xed Widget Button

ou

t Widgetpaint

ButtonsetLabel

fix

ed Widget Button in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetFont

Button

fix

ed Widget Button

Page 47: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Mixin Constructions

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Buttonfi

xed Widget Button

ou

t Widgetpaint

ButtonsetLabel

fix

ed Widget Button in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetFont

Button

fix

ed Widget Button

Page 48: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Mixin Constructions

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Button

fixe

dWidget Button

ou

t Widgetpaint

ButtonsetLabel

fixe

d

Widget Button in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetFont

Button

fixe

d

Widget Button

Widgetpaint

setColorsetFont

ButtonsetLabel

Page 49: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Mixin Constructions

in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetColor

Button

fixe

dWidget Button

ou

t Widgetpaint

ButtonsetLabel

fixe

d

Widget Button in

Widgetpaint

ButtonsetLabel

ou

t WidgetsetFont

Button

fixe

d

Widget Button

Widgetpaint

setColorsetFont

ButtonsetLabel

Page 50: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Pragmatics

Separates core and component languages Operates on class files Executes on Java Virtual Machines

See our poster

Page 51: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Some Related Work

Program Units – [Flatt et al., POPL ‘98]

MultiJava – [Millstein et al., OOPSLA ‘00]

Mixin Modules – [Duggan and Techaubol OOPSLA ‘01]

Page 52: Jiazzi: New-Age Components for Old-Fashioned Java Sean McDirmid Matthew Flatt Wilson C. Hsieh School of Computing University of Utah.

Summary

Separate compilation External linking Cyclic linking Mixin constructions

http://www.cs.utah.edu/plt/jiazzi