paninij generating capsule systems from annotated java
play

@PaniniJ: Generating Capsule Systems from Annotated Java Dec15-12: - PowerPoint PPT Presentation

@PaniniJ: Generating Capsule Systems from Annotated Java Dec15-12: Trey Erenberger, Dalton Mills, and David Johnston Overview Project Foundations: Capsule Oriented Programming Goals of @PaniniJ How It Works Usability and


  1. @PaniniJ: Generating Capsule Systems from Annotated Java Dec15-12: Trey Erenberger, Dalton Mills, and David Johnston

  2. Overview ● Project Foundations: Capsule Oriented Programming ● Goals of @PaniniJ ● How It Works ● Usability and Maintainability Improvements

  3. Project Goal Make Capsule Oriented Programming more accessible to Java programmers

  4. Concurrent Programming Concurrent Programming in Java is Hard

  5. 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!”);

  6. 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.

  7. The Problem With PaniniJ: Few Development Tools

  8. Initial Project Specification Build an Eclipse Plugin for PaniniJ to: ● Fix red squiggles ● Provide useful compilation errors & warnings ● Enable code completion & IDE features

  9. Eclipse Plugin Pro: It would work. Con: IDE lock in Con: Maintainability hurdles Con: Usability hurdles

  10. 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.

  11. Alternative: Compiler Plugin Pro: Core Java Feature (Annotation Processor) Pro: IDE Independent Con: Required Reimplementation Functionality of PaniniJ

  12. Deciding Factor: Use Standard Tools Standard compiler plugin strategy met all 3 goals. Bring panini to tools rather than tools to panini.

  13. @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.

  14. Code Generation

  15. Annotation Processing Pipeline User’s Capsule Auto-Generated Executable Templates Source Artifacts Capsule System (.java files) (.java files) (.class files)

  16. @PaniniJ Java Compiler Annotation Processor Capsule Interface Capsule Template Executable Capsule$Thread .class files Inter-Capsule Messages Many Artifacts are Generated From One Capsule Template

  17. Capsule System Includes Many Artifacts From Many Capsule Templates

  18. User’s Capsule Template

  19. Capsule Interface Capsule$Thread Inter-Capsule Messages User’s Capsule Template

  20. Generated Capsule Interface

  21. Capsule Interface Capsule$Thread Inter-Capsule Messages User’s Capsule Template

  22. Generated Multithreaded Wrapper

  23. Capsule Interface Capsule$Thread Inter-Capsule Messages User’s Capsule Template

  24. Generated Message Wrapper

  25. Capsule Interface Capsule$Thread Inter-Capsule Messages User’s Capsule Template

  26. Static Checks

  27. Static Checking Exposing Panini Model via IDE ● Rules identified and implemented as checks. ● Reported from annotation processor ● Violations displayed in context ● 45 checks implemented

  28. Static Checking in Eclipse

  29. Static Checking in NetBeans

  30. Improving Maintainability and Usability

  31. Annotation Processor @Capsule Template Capsule ( .java ) Model Capsule Capsule Capsule Template Artifact Artifacts ( .java ) Checks Factories Procedure Models Message Message Artifact Artifacts Return Param ( .java ) Factories Type Type Models Models PaniniProcessor : Refactored Capsule Processing Dataflow

  32. Improving Testing Testing Methods ● Invoke compiler with Maven ● Programmatically invoke compiler with javax.tools ● Unit testing with Google’s compile-testing

  33. Getting Started Website

  34. Usability: Documentation Annotation Processor Javadoc

  35. 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.

  36. Questions?

  37. Questions?

  38. Spring Semester ● Background: Capsules and PaniniJ ● Identify (specific) client goals ● Reformulated project as @PaniniJ ● Built working prototype

  39. Fall Semester ● Refine Prototype into Product ○ Processor Refactor ○ Unit & Integration Tests ● Documentation ● Usability Enhancements ○ Static Checks ○ Setup/Compile/Run Ease ● v0.1.0 release

  40. Example Program: “Hello, World!”

  41. “Hello World” Example Greeter Stores and sends a greeting HelloWorld Creates and drives activity Console Writes a string

  42. “Hello World” Example Greeter greet() HelloWorld run() Console write(String)

  43. “Hello World” Example Greeter { @Imports Stream s HelloWorld { } @Local Greeter g; @Local Console c; } Console

  44. Greeter HelloWorld Console @Capsule ● ● User-defined procedure “Hello World”: Capsule Template Syntax

  45. TODO: Change annotations! Greeter HelloWorld Console @Wired ● init() ● ● User-defined procedure “Hello World”: Capsule Template Syntax

  46. TODO: Change annotations! Greeter HelloWorld Console @Local ● design() ● run() ● imports() ● “Hello World”: Capsule Template Syntax

  47. Designing Capsule Artifact Inheritance

  48. Designing Additional Message Types

  49. Background: Our Client ● ISU Laboratory For Software Design ● Advisor: Dr. Hridesh Rajan ● Research: ○ Software Engineering ○ Programming Language Design ● Collaborators: Panini Project Grad Students

  50. 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.

  51. 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

Recommend


More recommend