Mps Presentation
Upcoming SlideShare
Loading in...5
×
 

Mps Presentation

on

  • 1,932 views

 

Statistics

Views

Total Views
1,932
Views on SlideShare
1,929
Embed Views
3

Actions

Likes
2
Downloads
10
Comments
0

1 Embed 3

http://www.slideshare.net 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Mps Presentation Mps Presentation Presentation Transcript

  • Extending Java And Developing DSLs With JetBrains MPS Konstantin Solomatov JetBrains Lead Developer for JetBrains MPS Project
  • Agenda
    • Extending languages. Why bother?
    • Problems and solutions
      • Composability
      • Language support
    • MPS’ approach
      • Idea behind it
      • Hands-on demo
    • MPS & domain-specific languages
  • Why Bother?
    • Specific domains = specific entities
    • Drawbacks of general-purpose languages:
      • Limited set of generic constructs
      • Domains are described too verbosely
      • Low code maintainability
    • Domain-specific extensions
      • Higher abstraction level
      • Higher maintainability
  • Implicit Language Extensions
    • Domain-specific constructs in Java:
      • synchronized block in Java
      • enhanced for in Java
      • typesafe enums in Java
    • Desired constructs:
      • closures
      • yield
      • better support for regexps
      • whatever else you are missing
  • Language Extensions
    • Existing extensions
      • Cover domain-specific needs
      • Are built into existing languages
    • Further extensions
      • Hard to integrate
      • Too long to wait until JCP accepts them 
      • Risks of incompatibility
  • MPS DEMO
    • Closure & UI Language samples.
  • Agenda
    • Extending Languages. Why bother?
    • Problems and Solutions
      • Composability
      • Language support
    • MPS’ Approach
      • Idea behind it
      • Hands-on Demo
    • MPS & Domain-Specific Languages
  • Composability
    • Definition:
    • Components are composable when they can be used together even if created by different parties
  • Composability Desired Goal
    • Java Libraries
    • Hibernate
    • Spring
    • Joda Time
    • Java Extensions
    • DB Language
    • DI Language
    • Dates Language
  • Composability Libraries vs. Extensions
    • Libraries are composable:
      • Java + Hibernate => OK
      • Java + Spring => OK
      • Java + Hibernate, Spring => OK
    • Language extensions are not
      • Java + extension A => OK
      • Java + extension B => OK
      • Java + extensions A, B => possible ambiguity
  • Composability Grammar Ambiguity Sample With String Interpolation
    • Extension “A”:
    • int resultsCount = <some_code>; string s = “Found ${resultCount} results”;
    • Extension “B”:
    • int resultCount = <some_code>; string t = “Found {resultCount} results”;
    • “ A” + “B” => ambiguity for the compiler:
    • string a = “Account balance is $ {balance} ”;
  • Language Support Requirements
    • Generic infrastructure
      • Abstract grammar
      • Type system
      • Compiler
      • Etc.
    • IDE infrastructure
      • Editor
      • Error highlighting
      • Refactoring
      • Version control
      • Etc.
  • Language Support Problems
    • Time- and resource-consuming task
      • Complicated algorithms for processing code
      • Highly qualified developers required
    • Resulting infrastructure composability
      • Type systems to be compatible with different extensions
      • Refactorings should support potential extensions
      • Etc.
  • Existing Solutions Pros & Cons Composability Language Infrastructure LISP Yes No Internal DSLs in Ruby / Groovy Yes No XText Framework No Yes
  • Common Problem
    • Existing solutions provide:
      • Either composable language extensions
      • Or a decent infrastructure
      • Not both
  • Agenda
    • Extending Languages. Why bother?
    • Problems and Solutions
      • Composability
      • Language support
    • MPS’ Approach
      • Idea behind it
      • Hands-on Demo
    • MPS & Domain-Specific Languages
  • Our Solution to the Problem
    • JetBrains MPS
      • Workbench for defining and extending languages
      • IDE for new languages and extensions
  • Idea Behind It
    • Text-based grammars lead to ambiguities
    • Another approach needed
    • MPS works with Abstract Syntax Tree directly
  • Idea Behind It Editing Abstract Syntax Tree
    • Former attempts
      • Diagram-based editing
      • Limited domain of application
    • MPS solution
      • Keeps user in habitual environment
      • Supports text-like editing
  • Idea Behind It Projectional Editor
    • Each node of a syntax tree has its projection in the MPS Editor
  • Idea Behind It Projectional Editor
    • Each node – in a dedicated cell
    • A node is shown in its text/symbol representation
    • Instantly synchronized editor and syntax tree
  • Idea Behind It Projection vs. Text
    • Text-like projectional editor
    • Has its pros & cons
    • Reasonable learning curve: approx. 2 weeks
  • MPS DEMO
    • Projectional editor in use.
  • Idea Behind It Language Support
    • User-defined language infrastructure
      • Abstract grammar
      • Type system
      • Editor
      • Compiler
      • Etc.
    • Programming assistance
      • Completion
      • Find usages
      • Rename
      • Etc.
  • Idea Behind It Existing Languages & Extensions
    • Java™ re-implemented with MPS + Extensions
      • Collections language
      • Dates language
      • Closures language
      • Regexp language
      • Etc.
    • Language definition languages
      • Implemented with themselves i.e. bootstrapped
    • Misc languages (XML, etc.)
  • Hands-On Demo Goal
    • Java
    • ReadWriteLock l = …
    • l.readLock().lock();
    • try {
    • //code
    • } finally {
    • l.readLock().unlock();
    • }
    • Java + Extension
    • ReadWriteLock l = …
    • read (l) {
    • //code
    • }
  • Hands-On Demo Workflow
    • We will define
      • Structure
      • Editor
      • Typesystem
      • Generator
  • MPS DEMO
    • Adding lock statement to Java
  • Agenda
    • Extending Languages. Why bother?
    • Problems and Solutions
      • Composability
      • Language support
    • MPS’ Approach
      • Idea behind it
      • Hands-on Demo
    • MPS & Domain-Specific Languages
  • Domain-Specific Languages
    • MPS suits nicely for creating DSLs
    • Common language parts can be reused
    • (e.g., expression language)
    • You can embed general-purpose languages (e.g., Java) inside DSLs
  • Domain-Specific Languages Example
  • Existing Applications
    • Charisma – bug tracking system
      • Completely developed with MPS
      • Used internally
      • EAP program
    • Languages for Web Development
      • DNQ
      • Webr
      • Spring language
  • Licensing/Pricing
    • Almost fully open-sourced
    • Apache 2.0 License
    • MPS is absolutely FREE
  • Q & A
  • More info
    • http://www.jetbrains.com/mps - MPS page
    • http://blogs.jetbrains.com/mps - MPS blog
  • Konstantin Solomatov [email_address] Lead Developer for JetBrains MPS Project http://www.jetbrains.com/mps Thank You