SlideShare a Scribd company logo
1 of 40
Ensō

            William Cook, Alex Loh
                    UT Austin
             Tijs van der Storm
                      CWI
UT Austin
Prevent Bad


                     Enable Good
UT Austin




                                   2
Bug Finding
       Race Detection
       Type Checking
       etc.

                  Prevent Bad


                           Enable Good
UT Austin




                                         3
Bug Finding
       Race Detection
       Type Checking
       etc.

                  Prevent Bad


                           Enable Good
                                New languages?
UT Austin




                                 New features?
                                      For what?
Bug Finding
       Race Detection
       Type Checking
       etc.

                  Prevent Bad
        Advantages:
        Measurable
        Domain-free        Enable Good
                                New languages?
UT Austin




                                 New features?
                                      For what?
Kolmogorov Complexity
UT Austin




                                    6
Shortest program
                    that
            generates information
UT Austin




                                    7
Best
              Shortest program
                     that
            generates information
                        behavior
UT Austin




                                    8
Best
               Shortest program
                      that
             generates information
                         behavior

     Qualitative Kolmogorov
UT Austin




      Program Complexity             9
I don't know how
UT Austin




                               10
but it’s a good goal
UT Austin




                                   11
A Problem

             1. Many (many!) repeated
              instances of similar code

            2. Unique details and names
               prevent generalization
UT Austin




                                          12
Requirements
               (what)

                           Strategies
                              (how)


             Application    Behavior
UT Austin




               (Code)                   13
Small change to
             Requirements

                               Very different
                               Strategies


              Application
              Application
              Very different
UT Austin




                (Code)
                 (Code)          Behavior
                   Code                     14
Small change to
             Requirements

                               Very different
                               Strategies
  Chaos!

              Application
              Application
              Very different
UT Austin




                (Code)
                 (Code)          Behavior
                   Code                     15
Requirements
               (what)            Reify!?

                           Strategies
                              (how)


             Application    Behavior
UT Austin




               (Code)                   16
Requirements                  Technical
                                  Requirements


                       Models


                     Strategies
UT Austin




                      Behavior              17
Data                    Technical
            Requirements              Requirements

                            Data
                            Model


                            Data
                           Manager
UT Austin




                            Objects             18
Using Managed Data (Ruby)
            • Description of data to be managed
              Point = { x: Integer, y: Integer }
            • Dynamic creation based on metadata
              p = BasicRecord.new Point
              p.x= 3
              p.y= -10
              print p.x + p.y
              p.z = 3 # error!
            • Factory BasicRecord: Descrption<T> T
UT Austin




                                                      19
Implementing Managed Data
            • Override the "dot operator" (p.x)
            • Reflective handling of unknown methods
               •   Ruby method_missing
               •   Smalltalk: doesNotUnderstand
               •   Also IDispatch, Python, Objective-C, Lua, CLOS
               •   Martin Fowler calls it "Dynamic Reception"
            • Programmatic method creation
               • E.g. Ruby define_method
UT Austin




            • Partial evaluation
                                                                    20
Other Data Managers
            •   Mutability: control whether changes allowed
            •   Observable: posts notifications
            •   Constrained: checks multi-field invariants
            •   Derived: computed fields (reactive)
            •   Secure: checks authorization rules
            •   Graph: inverse fields (bidirectional)
            •   Persistence: store to database/external format
            •   General strategy for all accesses/updates
UT Austin




            •   Combine them for modular strategies
                                                             21
Grammars
            • Mapping between text and object graph
            • A point is written as (x, y)
                Individual                 Grammar
               (3, 4)        P ::= [Point] "("x:int "," y:int")"

                                 class           fields
            • Notes:
              • Direct reading, no abstract syntax tree (AST)
UT Austin




              • Bidirectional: can parse and pretty-print
              • GLL parsing, interpreted!                          22
Door StateMachine        StateMachine Grammar
        start Opened             M::= [Machine] "start" start:</states[it]>states:S*
                                 S ::= [State] "state" name:symout:T*
        state Opened             T ::= [Trans] "on" event:sym "go" to:</states[it]>
         on close go Closed

        state Closed                                                StateMachine
                              A StateMachine Interpreter            Schema
                                                                    class Machine
         on open go Opened
         on lock go Locked    def run_state_machine(m)               start : State
                               current = m.start                     states! State*
        state Locked           while gets
                                puts "#{current.name}"              class State
         on unlock go                                                machine: Machine
                                input = $_.strip
        Closed                current.out.eachdo |trans|             name # str
                                 if trans.event == input             out ! Trans*
                                   current = trans.to                in     : Trans*
        State                 end
                                   break
                                                                    class Trans

        Machine               end                                    event : str
UT Austin




                               end                                   from : State / out
                              end                                    to     : State / in
        Example                                                                         23
Sample Expression            Expression Grammar
                                     E ::= [Add] left:E "+" right:M | M
                                     M ::= [Mul] left:M "*" right:P | P
        3*(5+6)                      P ::= [Num] val:int            | "(" E ")"



                               An Expression Interpreter               Expression Schema
                            module Eval                                class Exp
                             operation :eval
                                                                       class Num
                             def eval_Num(val)                         val : int
                            val
                             end                                       class Add
                                                                        left : Exp
                             def eval_Add(left, right)                  right : Exp
Expression                  left.eval + right.eval
                             end                                       class Mul

Example                      def eval_Mul(left, right)
                                                                        left : Exp
                                                                        right : Exp
UT Austin




                            left.eval * right.eval
                             end
                            end                                                        24
Grammar Grammar
            start G
            G ::= [Grammar] "start" start:</rules[it]>rules:R*
            R ::= [Rule]      name:sym "::=" arg:A
            A ::= [Alt]       alts:C+ @"|"
            C ::= [Create] "[" name:sym "]" arg:S | S
            S ::= [Sequence] elements:F*
            F ::= [Field]     name:sym ":" arg:P         | P
            P ::= [Lit]       value:str
                 | [Value] kind:("int" | "str" | "real" | "sym")
                 | [Ref] "<" path:Path ">"            non-terminal name
                 | [Call] rule:</rules[it]>           reference to rule
                 | [Code] "{" code:Expr "}"
                 | [Regular] arg:P "*" Sep? { optional && many }
UT Austin




                | [Regular] arg:P "?"            { optional }
                | "(" A ")"
            Sep ::= "@" sep:P                                            25
Quad-model
UT Austin




              Nontrivial
            bootstrapping                26
Diagrams
            • Model
               • Shapes and connectors
            • Interpreter
               • Diagram render/edit application
               • Basic constraint solver
UT Austin




                                                   27
Schema Diagram
UT Austin




                             28
Stencils
            • Model: mapping object graph  diagram
            • Interpreter
              • Inherits functionality of Diagram editor
              • Maps object graph to diagram
                 –Update projection if objects change
              • Maps diagram changes back to object graph
              • Binding for data and collections
                 –Strategy uses schema information
                 –Relationships get drop-downs, etc
UT Austin




                 –Collections get add/remove menus
                                                            29
Schema Diagram Editor
UT Austin




                                    30
Schema Stencil
            diagram(schema)
            graph [font.size=12,fill.color=(255,255,255)] {
            for "Class" class : schema.classes
            label class
            box [line.width=3, fill.color=(255,228,181)] {
            vertical {
            text [font.size=16,font.weight=700] class.name
            for "Field" field : class.defined_fields
            if (field.typeis Primitive)
            horizontal {
            text field.name // editable field name
            text ": "
UT Austin




            text field.type.name // drop-down for type
                       }}}}
                                                              31
Schema Stencil: Connectors
             …
            // create the subclass links
            for class : schema.classes
            for "Parent" super : class.supers
            connector [line.width=3, line.color=(255,0,0)]
                   (class --> super)
            …
            [also for relationships]
UT Austin




                                                             32
Ensō Summary
            • Executable Specification Languages
               • Data, grammar, GUI, Web, Security, Queries, etc.
            • External DSLs (not embeded)
            • Interpreters (not compilers/model transform)
               • Multiple interpreters for each languages
            • Composition of Languages/Interpreters
               • Reuse, extension, derivation (inheritance)
            • Self-implemented (Ruby for base/interpreters)
               • Partial evaluation for speed
UT Austin




                                                                    33
Spectrum of programming




   How                                    What
   (implementation)                (Specification)
UT Austin




                                               34
How                                      What
   (implementation)                  (Specification)




                      Verification
UT Austin




                                                 35
Synthesis


   How                                      What
   (implementation)                  (Specification)




                      Verification
UT Austin




                                                 36
Synthesis


   How                        Domain-Specific            What
   (implementation)            Specifications     (Specification)

                    Verification
                        Lite
                                   Verification
UT Austin




       Verification Lite
       = Type checking                                        37
Enso is "Synthesis Lite": Fully
    automated from domain-
    specific specification language

                                        Synthesis
                 Synthesis                 (guided)
                    Lite
   How                   Domain-Specific                     What
   (implementation)        Specifications             (Specification)

                 Verification
                     Lite
                                      Verification
UT Austin




                                                                  38
Don't Design
            Your Programs
UT Austin




                            39
Program
            Your Designs

                  Ensō
              enso-lang.org
UT Austin




                              40

More Related Content

Viewers also liked (6)

Newsletter september 2012
Newsletter   september 2012Newsletter   september 2012
Newsletter september 2012
 
HR Optimization
HR OptimizationHR Optimization
HR Optimization
 
Global HR Practices
Global HR PracticesGlobal HR Practices
Global HR Practices
 
Introduction to the internet
Introduction to the internetIntroduction to the internet
Introduction to the internet
 
Termo de saneamento unip
Termo de saneamento unipTermo de saneamento unip
Termo de saneamento unip
 
Química cerebral
Química cerebralQuímica cerebral
Química cerebral
 

Similar to Enso presented at Microsoft Research/CSW summer 2012

Declarative Multilingual Information Extraction with SystemT
Declarative Multilingual Information Extraction with SystemTDeclarative Multilingual Information Extraction with SystemT
Declarative Multilingual Information Extraction with SystemT
Laura Chiticariu
 
empirical software engineering, v2.0
empirical software engineering, v2.0empirical software engineering, v2.0
empirical software engineering, v2.0
CS, NcState
 

Similar to Enso presented at Microsoft Research/CSW summer 2012 (20)

Icsm08a.ppt
Icsm08a.pptIcsm08a.ppt
Icsm08a.ppt
 
Declarative Multilingual Information Extraction with SystemT
Declarative Multilingual Information Extraction with SystemTDeclarative Multilingual Information Extraction with SystemT
Declarative Multilingual Information Extraction with SystemT
 
Machine Learning: Past, Present and Future - by Tom Dietterich
Machine Learning: Past, Present and Future - by Tom DietterichMachine Learning: Past, Present and Future - by Tom Dietterich
Machine Learning: Past, Present and Future - by Tom Dietterich
 
Jubatus: Realtime deep analytics for BIgData@Rakuten Technology Conference 2012
Jubatus: Realtime deep analytics for BIgData@Rakuten Technology Conference 2012Jubatus: Realtime deep analytics for BIgData@Rakuten Technology Conference 2012
Jubatus: Realtime deep analytics for BIgData@Rakuten Technology Conference 2012
 
Advanced malware analysis training session3 botnet analysis part2
Advanced malware analysis training session3 botnet analysis part2Advanced malware analysis training session3 botnet analysis part2
Advanced malware analysis training session3 botnet analysis part2
 
“Reinforcement Learning: a Practical Introduction,” a Presentation from Micro...
“Reinforcement Learning: a Practical Introduction,” a Presentation from Micro...“Reinforcement Learning: a Practical Introduction,” a Presentation from Micro...
“Reinforcement Learning: a Practical Introduction,” a Presentation from Micro...
 
Lecture23
Lecture23Lecture23
Lecture23
 
CONFidence 2014: Davi Ottenheimer Protecting big data at scale
CONFidence 2014: Davi Ottenheimer Protecting big data at scaleCONFidence 2014: Davi Ottenheimer Protecting big data at scale
CONFidence 2014: Davi Ottenheimer Protecting big data at scale
 
empirical software engineering, v2.0
empirical software engineering, v2.0empirical software engineering, v2.0
empirical software engineering, v2.0
 
Autonomous Learning for Autonomous Systems, by Prof. Plamen Angelov
Autonomous Learning for Autonomous Systems, by Prof. Plamen AngelovAutonomous Learning for Autonomous Systems, by Prof. Plamen Angelov
Autonomous Learning for Autonomous Systems, by Prof. Plamen Angelov
 
It Does What You Say, Not What You Mean: Lessons From A Decade of Program Repair
It Does What You Say, Not What You Mean: Lessons From A Decade of Program RepairIt Does What You Say, Not What You Mean: Lessons From A Decade of Program Repair
It Does What You Say, Not What You Mean: Lessons From A Decade of Program Repair
 
Software testing
Software testingSoftware testing
Software testing
 
Applications of Machine Learning and Metaheuristic Search to Security Testing
Applications of Machine Learning and Metaheuristic Search to Security TestingApplications of Machine Learning and Metaheuristic Search to Security Testing
Applications of Machine Learning and Metaheuristic Search to Security Testing
 
Bridging the Gap: Machine Learning for Ubiquitous Computing -- ML and Ubicomp...
Bridging the Gap: Machine Learning for Ubiquitous Computing -- ML and Ubicomp...Bridging the Gap: Machine Learning for Ubiquitous Computing -- ML and Ubicomp...
Bridging the Gap: Machine Learning for Ubiquitous Computing -- ML and Ubicomp...
 
Hala GPT - Samer Desouky.pdf
Hala GPT - Samer Desouky.pdfHala GPT - Samer Desouky.pdf
Hala GPT - Samer Desouky.pdf
 
Testing In Production (TiP) Advances with Big Data & the Cloud
Testing In Production (TiP) Advances with Big Data & the CloudTesting In Production (TiP) Advances with Big Data & the Cloud
Testing In Production (TiP) Advances with Big Data & the Cloud
 
Data mining and Machine learning expained in jargon free & lucid language
Data mining and Machine learning expained in jargon free & lucid languageData mining and Machine learning expained in jargon free & lucid language
Data mining and Machine learning expained in jargon free & lucid language
 
Big Data and OSS at IBM
Big Data and OSS at IBMBig Data and OSS at IBM
Big Data and OSS at IBM
 
Towards Set Learning and Prediction - Laura Leal-Taixe - UPC Barcelona 2018
Towards Set Learning and Prediction - Laura Leal-Taixe - UPC Barcelona 2018Towards Set Learning and Prediction - Laura Leal-Taixe - UPC Barcelona 2018
Towards Set Learning and Prediction - Laura Leal-Taixe - UPC Barcelona 2018
 
White-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTestWhite-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTest
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Enso presented at Microsoft Research/CSW summer 2012

  • 1. Ensō William Cook, Alex Loh UT Austin Tijs van der Storm CWI UT Austin
  • 2. Prevent Bad Enable Good UT Austin 2
  • 3. Bug Finding Race Detection Type Checking etc. Prevent Bad Enable Good UT Austin 3
  • 4. Bug Finding Race Detection Type Checking etc. Prevent Bad Enable Good New languages? UT Austin New features? For what?
  • 5. Bug Finding Race Detection Type Checking etc. Prevent Bad Advantages: Measurable Domain-free Enable Good New languages? UT Austin New features? For what?
  • 7. Shortest program that generates information UT Austin 7
  • 8. Best Shortest program that generates information behavior UT Austin 8
  • 9. Best Shortest program that generates information behavior Qualitative Kolmogorov UT Austin Program Complexity 9
  • 10. I don't know how UT Austin 10
  • 11. but it’s a good goal UT Austin 11
  • 12. A Problem 1. Many (many!) repeated instances of similar code 2. Unique details and names prevent generalization UT Austin 12
  • 13. Requirements (what) Strategies (how) Application Behavior UT Austin (Code) 13
  • 14. Small change to Requirements Very different Strategies Application Application Very different UT Austin (Code) (Code) Behavior Code 14
  • 15. Small change to Requirements Very different Strategies Chaos! Application Application Very different UT Austin (Code) (Code) Behavior Code 15
  • 16. Requirements (what) Reify!? Strategies (how) Application Behavior UT Austin (Code) 16
  • 17. Requirements Technical Requirements Models Strategies UT Austin Behavior 17
  • 18. Data Technical Requirements Requirements Data Model Data Manager UT Austin Objects 18
  • 19. Using Managed Data (Ruby) • Description of data to be managed Point = { x: Integer, y: Integer } • Dynamic creation based on metadata p = BasicRecord.new Point p.x= 3 p.y= -10 print p.x + p.y p.z = 3 # error! • Factory BasicRecord: Descrption<T> T UT Austin 19
  • 20. Implementing Managed Data • Override the "dot operator" (p.x) • Reflective handling of unknown methods • Ruby method_missing • Smalltalk: doesNotUnderstand • Also IDispatch, Python, Objective-C, Lua, CLOS • Martin Fowler calls it "Dynamic Reception" • Programmatic method creation • E.g. Ruby define_method UT Austin • Partial evaluation 20
  • 21. Other Data Managers • Mutability: control whether changes allowed • Observable: posts notifications • Constrained: checks multi-field invariants • Derived: computed fields (reactive) • Secure: checks authorization rules • Graph: inverse fields (bidirectional) • Persistence: store to database/external format • General strategy for all accesses/updates UT Austin • Combine them for modular strategies 21
  • 22. Grammars • Mapping between text and object graph • A point is written as (x, y) Individual Grammar (3, 4) P ::= [Point] "("x:int "," y:int")" class fields • Notes: • Direct reading, no abstract syntax tree (AST) UT Austin • Bidirectional: can parse and pretty-print • GLL parsing, interpreted! 22
  • 23. Door StateMachine StateMachine Grammar start Opened M::= [Machine] "start" start:</states[it]>states:S* S ::= [State] "state" name:symout:T* state Opened T ::= [Trans] "on" event:sym "go" to:</states[it]> on close go Closed state Closed StateMachine A StateMachine Interpreter Schema class Machine on open go Opened on lock go Locked def run_state_machine(m) start : State current = m.start states! State* state Locked while gets puts "#{current.name}" class State on unlock go machine: Machine input = $_.strip Closed current.out.eachdo |trans| name # str if trans.event == input out ! Trans* current = trans.to in : Trans* State end break class Trans Machine end event : str UT Austin end from : State / out end to : State / in Example 23
  • 24. Sample Expression Expression Grammar E ::= [Add] left:E "+" right:M | M M ::= [Mul] left:M "*" right:P | P 3*(5+6) P ::= [Num] val:int | "(" E ")" An Expression Interpreter Expression Schema module Eval class Exp operation :eval class Num def eval_Num(val) val : int val end class Add left : Exp def eval_Add(left, right) right : Exp Expression left.eval + right.eval end class Mul Example def eval_Mul(left, right) left : Exp right : Exp UT Austin left.eval * right.eval end end 24
  • 25. Grammar Grammar start G G ::= [Grammar] "start" start:</rules[it]>rules:R* R ::= [Rule] name:sym "::=" arg:A A ::= [Alt] alts:C+ @"|" C ::= [Create] "[" name:sym "]" arg:S | S S ::= [Sequence] elements:F* F ::= [Field] name:sym ":" arg:P | P P ::= [Lit] value:str | [Value] kind:("int" | "str" | "real" | "sym") | [Ref] "<" path:Path ">" non-terminal name | [Call] rule:</rules[it]> reference to rule | [Code] "{" code:Expr "}" | [Regular] arg:P "*" Sep? { optional && many } UT Austin | [Regular] arg:P "?" { optional } | "(" A ")" Sep ::= "@" sep:P 25
  • 26. Quad-model UT Austin Nontrivial bootstrapping 26
  • 27. Diagrams • Model • Shapes and connectors • Interpreter • Diagram render/edit application • Basic constraint solver UT Austin 27
  • 29. Stencils • Model: mapping object graph  diagram • Interpreter • Inherits functionality of Diagram editor • Maps object graph to diagram –Update projection if objects change • Maps diagram changes back to object graph • Binding for data and collections –Strategy uses schema information –Relationships get drop-downs, etc UT Austin –Collections get add/remove menus 29
  • 31. Schema Stencil diagram(schema) graph [font.size=12,fill.color=(255,255,255)] { for "Class" class : schema.classes label class box [line.width=3, fill.color=(255,228,181)] { vertical { text [font.size=16,font.weight=700] class.name for "Field" field : class.defined_fields if (field.typeis Primitive) horizontal { text field.name // editable field name text ": " UT Austin text field.type.name // drop-down for type }}}} 31
  • 32. Schema Stencil: Connectors … // create the subclass links for class : schema.classes for "Parent" super : class.supers connector [line.width=3, line.color=(255,0,0)] (class --> super) … [also for relationships] UT Austin 32
  • 33. Ensō Summary • Executable Specification Languages • Data, grammar, GUI, Web, Security, Queries, etc. • External DSLs (not embeded) • Interpreters (not compilers/model transform) • Multiple interpreters for each languages • Composition of Languages/Interpreters • Reuse, extension, derivation (inheritance) • Self-implemented (Ruby for base/interpreters) • Partial evaluation for speed UT Austin 33
  • 34. Spectrum of programming How What (implementation) (Specification) UT Austin 34
  • 35. How What (implementation) (Specification) Verification UT Austin 35
  • 36. Synthesis How What (implementation) (Specification) Verification UT Austin 36
  • 37. Synthesis How Domain-Specific What (implementation) Specifications (Specification) Verification Lite Verification UT Austin Verification Lite = Type checking 37
  • 38. Enso is "Synthesis Lite": Fully automated from domain- specific specification language Synthesis Synthesis (guided) Lite How Domain-Specific What (implementation) Specifications (Specification) Verification Lite Verification UT Austin 38
  • 39. Don't Design Your Programs UT Austin 39
  • 40. Program Your Designs Ensō enso-lang.org UT Austin 40

Editor's Notes

  1. strategy iswoven into code  unique everywhere, similar everywheresmall change to strategycan causelarge change to code  Chaos
  2. strategy iswoven into code  unique everywhere, similar everywheresmall change to strategycan causelarge change to code  Chaos
  3. strategy iswoven into code  unique everywhere, similar everywheresmall change to strategycan causelarge change to code  Chaos