@paninij: generating capsule systems from annotated...
TRANSCRIPT
![Page 1: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/1.jpg)
@PaniniJ: Generating Capsule Systems from Annotated JavaDec15-12: Trey Erenberger, Dalton Mills, and David Johnston
![Page 2: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/2.jpg)
Overview● Project Foundations: Capsule Oriented Programming● Goals of @PaniniJ● How It Works● Usability and Maintainability Improvements
![Page 3: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/3.jpg)
Project Goal
Make Capsule Oriented Programming more accessible to Java programmers
![Page 4: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/4.jpg)
Concurrent Programming
Concurrent Programming in Java is Hard
![Page 5: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/5.jpg)
Capsule Oriented Programming
One can think of it like a design pattern.● Capsule: Like an object with a thread inside.● System of Capsules: A collection of capsules
sending requests to each other.● Write sequential code; asynchronous code.● String s = fooCapsule.bar(“Hello, world!”);
![Page 6: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/6.jpg)
PaniniJ: The Existing Solution
● PaniniJ is a capsule-oriented language.
● Language is similar to Java.
● Modified Java compiler (panc) compiles PaniniJ code.
● Auto-generate boilerplate concurrent capsule code.
● Correct by construction concurrency.
![Page 7: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/7.jpg)
The Problem With PaniniJ: Few Development Tools
![Page 8: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/8.jpg)
Build an Eclipse Plugin for PaniniJ to:● Fix red squiggles● Provide useful compilation errors & warnings● Enable code completion & IDE features
Initial Project Specification
![Page 9: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/9.jpg)
Eclipse Plugin
Pro: It would work.Con: IDE lock inCon: Maintainability hurdlesCon: Usability hurdles
![Page 10: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/10.jpg)
Client Goals
Capsule Oriented Programming shall be:● More usable by Java programmers.● More compatible with existing Java tools.● Less complex to use within Java projects.
![Page 11: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/11.jpg)
Alternative: Compiler Plugin
Pro: Core Java Feature (Annotation Processor)Pro: IDE IndependentCon: Required Reimplementation Functionality of PaniniJ
![Page 12: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/12.jpg)
Deciding Factor: Use Standard Tools
Standard compiler plugin strategy met all 3 goals.
Bring panini to tools rather than tools to panini.
![Page 13: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/13.jpg)
@PaniniJ: Our Solution● The user defines a set of
capsule templates as Java classes.
● Each template describes properties and behavior of the desired capsule.
● @PaniniJ generates the concurrent Java code required for such a capsule.
![Page 14: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/14.jpg)
Code Generation
![Page 15: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/15.jpg)
User’s Capsule Templates
(.java files)
Auto-Generated Source Artifacts
(.java files)
Executable Capsule System
(.class files)
Annotation Processing Pipeline
![Page 16: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/16.jpg)
Capsule Template
Capsule Interface
Capsule$Thread
Inter-Capsule Messages
@PaniniJ Annotation Processor
Java Compiler
Executable.class files
Many Artifacts are Generated From One Capsule Template
![Page 17: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/17.jpg)
Capsule System Includes Many Artifacts From Many Capsule Templates
![Page 18: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/18.jpg)
User’s Capsule Template
![Page 19: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/19.jpg)
User’s Capsule Template
Capsule Interface
Capsule$Thread
Inter-Capsule Messages
![Page 20: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/20.jpg)
Generated Capsule Interface
![Page 21: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/21.jpg)
User’s Capsule Template
Capsule Interface
Capsule$Thread
Inter-Capsule Messages
![Page 22: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/22.jpg)
Generated Multithreaded Wrapper
![Page 23: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/23.jpg)
User’s Capsule Template
Capsule Interface
Capsule$Thread
Inter-Capsule Messages
![Page 24: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/24.jpg)
Generated Message Wrapper
![Page 25: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/25.jpg)
User’s Capsule Template
Capsule Interface
Capsule$Thread
Inter-Capsule Messages
![Page 26: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/26.jpg)
Static Checks
![Page 27: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/27.jpg)
Static CheckingExposing Panini Model via IDE● Rules identified and implemented as checks.● Reported from annotation processor● Violations displayed in context● 45 checks implemented
![Page 28: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/28.jpg)
Static Checking in Eclipse
![Page 29: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/29.jpg)
Static Checking in NetBeans
![Page 30: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/30.jpg)
Improving Maintainability and Usability
![Page 31: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/31.jpg)
Annotation Processor
PaniniProcessor: Refactored Capsule Processing Dataflow
@CapsuleTemplate(.java) Capsule
Artifacts(.java)
CapsuleTemplateChecks
CapsuleModel Capsule
Artifact Factories
MessageArtifact
Factories
MessageArtifacts(.java)
Return Type
Models
Param Type
Models
ProcedureModels
![Page 32: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/32.jpg)
Testing Methods● Invoke compiler with Maven● Programmatically invoke compiler with javax.tools● Unit testing with Google’s compile-testing
Improving Testing
![Page 33: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/33.jpg)
Getting Started Website
![Page 34: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/34.jpg)
Usability: Documentation
Annotation Processor Javadoc
![Page 35: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/35.jpg)
Client Goals
Capsule Oriented Programming shall be:● More usable by Java programmers.● More compatible with existing Java tools.● Less complex to use within Java projects.
![Page 36: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/36.jpg)
Questions?
![Page 37: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/37.jpg)
Questions?
![Page 38: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/38.jpg)
● Background: Capsules and PaniniJ● Identify (specific) client goals● Reformulated project as @PaniniJ● Built working prototype
Spring Semester
![Page 39: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/39.jpg)
Fall Semester● Refine Prototype into Product
○ Processor Refactor○ Unit & Integration Tests
● Documentation● Usability Enhancements
○ Static Checks○ Setup/Compile/Run Ease
● v0.1.0 release
![Page 40: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/40.jpg)
Example Program:“Hello, World!”
![Page 41: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/41.jpg)
“Hello World” Example
ConsoleWrites a string
GreeterStores and sends a
greetingHelloWorldCreates and drives activity
![Page 42: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/42.jpg)
“Hello World” Example
Consolewrite(String)
Greetergreet()
HelloWorldrun()
![Page 43: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/43.jpg)
“Hello World” Example
Console
Greeter { @Imports Stream s}HelloWorld {
@Local Greeter g; @Local Console c;}
![Page 44: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/44.jpg)
“Hello World”: Capsule Template Syntax
● @Capsule
● User-defined procedure
Console
GreeterHelloWorld
![Page 45: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/45.jpg)
“Hello World”: Capsule Template Syntax
● @Wired
● init()
● User-defined procedure
Console
GreeterHelloWorld
TODO: Change annotations!
![Page 46: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/46.jpg)
“Hello World”: Capsule Template Syntax
● @Local
● design()
● run()
● imports()
Console
GreeterHelloWorld
TODO: Change annotations!
![Page 47: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/47.jpg)
Designing Capsule Artifact Inheritance
![Page 48: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/48.jpg)
Designing Additional Message Types
![Page 49: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/49.jpg)
Background: Our Client
● ISU Laboratory For Software Design● Advisor: Dr. Hridesh Rajan● Research:
○ Software Engineering
○ Programming Language Design
● Collaborators: Panini Project Grad Students
![Page 50: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/50.jpg)
Background: Panini Project Vision
Make efficient programming abstractions which increase productivity and decrease maintenance costs by making
concurrent programming less error-prone.
Make concurrency less complicated.
![Page 51: @PaniniJ: Generating Capsule Systems from Annotated Javadec1512.sd.ece.iastate.edu/docs/project/final-presentation.pdf · Standard compiler plugin strategy met all 3 goals. Bring](https://reader034.vdocuments.us/reader034/viewer/2022050221/5f672411aa524a63637f77c0/html5/thumbnails/51.jpg)
Development Process● Rapid Application Development
○ Many prototypes which tackle small problems○ Documentation along the way
● Tools Used○ git, GitHub, GitHub Issues, GitHub wiki○ Eclipse, Maven