Towards Multi-lingual Programming Environments Tijs van der Storm, - - PowerPoint PPT Presentation

towards multi lingual programming environments
SMART_READER_LITE
LIVE PREVIEW

Towards Multi-lingual Programming Environments Tijs van der Storm, - - PowerPoint PPT Presentation

S oftware Analysis And Transformation Towards Multi-lingual Programming Environments Tijs van der Storm, Jurgen Vinju [Science of Computer Programming, 2013] (a grand challenge for SLE) TOPLAS 1985 Most programming environments are much


slide-1
SLIDE 1

Software Analysis And Transformation

Towards Multi-lingual Programming Environments

Tijs van der Storm, Jurgen Vinju [Science of Computer Programming, 2013]

(a grand challenge for SLE)

slide-2
SLIDE 2

SWAT - SoftWare Analysis And Transformation

“Most programming environments are much too complex.“ “… bringing the total number of languages that must be mastered to at least four.” “One way of simplifying … is to reduce the number

  • f mode-dependent

languages…” “A programmer interacting with a typical computer systems has to be something of a polyglot”

TOPLAS 1985

slide-3
SLIDE 3

SWAT - SoftWare Analysis And Transformation

2017; a web app in Eclipse

  • Java code
  • pom.xml
  • .classpath
  • .project
  • META-INF/MANIFEST.MF
  • JSP templates
  • SQL schema definitions
  • hibernate.properties
  • @Java annotations
  • HTML
  • PuppetFile (bash++++)
  • Jenkinsfile (Groovy)
  • 13 languages, excluding

the editor commands, the refactoring UI, etc. etc.

slide-4
SLIDE 4

SWAT - SoftWare Analysis And Transformation

Project Complexity

  • Programs in

Programming languages

  • Client code and

configuration files for using frameworks and libraries

  • Build scripts and meta-

data

  • Deployment scripts and

meta-data

  • Meta-features; editing

and refactoring, analysis

each of these artefacts have semantics which influences the quality of the software product

the artefacts depend on each

  • ther in order to arrive at the

expected result the artefacts’ supporting tools evolve (independently) the artefacts must co-evolve

slide-5
SLIDE 5

SWAT - SoftWare Analysis And Transformation

What to expect?

  • But, that’s all hand-waving.

Maybe it’s not so bad! Let’s just:

  • ignore the problem
  • or, quickly solve it
  • Well, we really don’t know

what real software looks like… (some of us might…)

  • Example: 80% of all Java

projects use the Reflection API in a ‘harmful’ manner [Landman2017]

  • 99% of all Java programs

depend on such Reflection via libraries.

  • Reflection currently breaks all

available IDE features in Java IDEs

slide-6
SLIDE 6

SWAT - SoftWare Analysis And Transformation

2017; IDE features

  • syntax highlighting, outlines
  • browsing use/def links
  • browsing call links
  • refactoring (!)
  • type checking (!)
  • debugger (!)
slide-7
SLIDE 7

SWAT - SoftWare Analysis And Transformation

2013 SCP

“In this paper we propose to view the de facto multiplicity of languages that a programmer is subjected to as a single, federated language.” “What is the syntax of this language? What is its semantics?” “How do we model name resolution, declarations, uses, control flow, data flow, and types for this language?” “Given answers to these questions, we will have a principled method of modeling cross language semantic dependency.”

slide-8
SLIDE 8

SWAT - SoftWare Analysis And Transformation

Challenges

  • Understand (i.e. “model”) the

full dependence relation between collaborating software artefacts written in different existing software languages “in a broad sense”

  • Derive common tool support

for each “federated language” which is the de-facto composition in each project

  • Supporting, beyond syntax
  • Static semantics integration
  • Dynamic semantics

integration

  • For legacy systems (of

systems)

  • Under continuous evolution
slide-9
SLIDE 9

SWAT - SoftWare Analysis And Transformation

Key enabler? SLE

  • Uniform representations of

intermediate semantic models, given by a shared meta-modeling language

  • A generic identification

mechanism of language artefacts at different levels

  • f granularity
  • All kinds of relations/Graphs
  • “Generating Interactive

Programming Environments” [Lang 1986]

  • We should know how to do

this then.

  • Or otherwise, we have

sticked our necks out far enough to have to find

  • ut.
slide-10
SLIDE 10

SWAT - SoftWare Analysis And Transformation

Some Serendipity…

  • Some frameworks already “solve” part of the

problem

  • .NET CLR
  • common language run-time
  • common calling convention
  • cross-language dependencies are

modelled into the underlying semantics of (almost) al .NET languages

  • LINQ
  • data providers are notoriously

dynamic and highly variable

  • LINQ provides a unified static and

dynamic semantics for all of them

  • if you model LINQ, you may have

enough details for any IDE support

  • Excellent design sometimes solves the

problem; if that design becomes the de- factor standard, we can charge ahead.

  • Ruby-on-rails?
slide-11
SLIDE 11

SWAT - SoftWare Analysis And Transformation

But.. harmful abstractions

  • What about Java & Scala? That should be easy too right?
  • The inter-language calling convention is obscure (at best)
  • In Scala people write powerful libraries (embedded DSLs)
  • On the JVM bytecode level then?
  • too much highly dynamic code (generated to work around Java’s/JVM static type system

and give Scala more modularity) [Tip 2014]

  • No free lunch
  • model static semantics for every version of the Scala compiler
  • and learn the semantics of the Scala libraries in use
  • and every version of Java and its relation to the JVM
slide-12
SLIDE 12

SWAT - SoftWare Analysis And Transformation

Harmful abstractions everywhere

  • Hibernate! That’s used everywhere and it maps OR to OO and back.

Let’s start there.

  • mmmm…. right..
  • “Hurdles in Multi-Language Refactoring of Hibernate

Applications” [Lämmel et al. 2011]

“Different programming languages can be involved in the implementation of a single software application. In these software applications, source code of one programming language interacts with code of a different language. By refactoring an artifact of one programming language, the interaction of this artifact with an artifact written in another programming language may break. We present a study on refactoring an software application that contains artifacts of different languages.”

6 pages 14 citations

slide-13
SLIDE 13

SWAT - SoftWare Analysis And Transformation

The universal “solution”

  • Brilliant plan:
  • map all languages to a universal AST
  • build all tools for this AST
  • brought down quadratic connections to linear
  • problem solved!
  • Except, that it hides complexity elsewhere and increases complexity
  • semantics of AST nodes matters greatly (“import”, “&&”)
  • cross-language dynamic semantics much, much harder than (partial) static semantics
  • mapping back to the original abstraction level may be impossible (no apparent BX)
  • who will write all the “Hibernate to UAST compilers?”
  • Well, then we make the mapping a lot shallower, syntactic even.
  • k. but then it’s just broken. go away.
slide-14
SLIDE 14

SWAT - SoftWare Analysis And Transformation

The ‘what-if’ solutions

  • Linguistic middleware (e.g. ToolBus)
  • Language-as-a-library (e.g. SugarJ, Silver, …)
  • Projectional editing (e.g. MPS)
  • Model Driven Engineering (e.g. EMF, Gemoc)

. “… [these] assume a future world in which all software will be written in a more integrated fashion, or a world in which all existing software will be transformed into the new integrated perspective.”


 “In [this] proposal the multiplicity of artifacts remains as it is. We take the reverse

engineering stance towards the languages, and the forward engineering stance towards their IDE: to make all their syntactic and semantic inter-relations manifest. “


slide-15
SLIDE 15

SWAT - SoftWare Analysis And Transformation

Towards Real Solutions

  • What about the reverse Engineering field?
  • similar goals! similar solutions?
  • MOOSE, KDM, M3, MoDisCO, Rigi, …
  • They give a real head start.
  • Their goals are design recovery and are often much fuzzier as a result
  • A refinement is necessary
  • Still, there is a lot of tools and ideas and experience out there to benefit from
  • generic data-dependence frameworks
  • system dependence graphs
  • agile parsing
  • We should to study first (a lot) before we start designing

LB’s like ASF+SDF, TXL and DMS, Eli have always been applied to reverse engineering as well as forward engineering The two application fields have to come together to make multi-language IDEs come true

slide-16
SLIDE 16

SWAT - SoftWare Analysis And Transformation

Solution Elements

  • Unique Universal Identification of Source Code Artefacts: loc superCl

= java+interf://java/util/List;

  • universal notion of identity enables tracking through language

barriers

  • Normalized graphs: rel[loc,loc] invocations = …;
  • many-to-many for modeling natural inaccuracy of static semantics
  • normalized for unanticipated re-combination
  • M3: Language adapters with detailed static models [Izmaylova 2012]
  • Java, C++, Javascript, PHP
  • Datalog-style inference rules (DOOP, Bravenboer 2011)
slide-17
SLIDE 17

SWAT - SoftWare Analysis And Transformation

CROSSMINER H2020 EU project

  • Continuation of “OSSMETER” (multi-information source quality analysis of open-source projects)
  • IDE of the future: providing right advice at the right time
  • Wisdom of the crowds (information from open-source code, issue trackers, stackoverflow, …)
  • Multi-language by necessity
  • Funding a part of the multi-language IDE vision now
  • Modeling PL (Java, C++, Javascript)
  • Modeling [IDE] plugin and deployment architectures (Eclipse P2)
  • Modeling cloud deployment infra-structures (Puppet)

DiRuscio, Vinju, Kolovos, Degueule, etc.

slide-18
SLIDE 18

SWAT - SoftWare Analysis And Transformation

There is quite a lot more to talk about…

slide-19
SLIDE 19

SWAT - SoftWare Analysis And Transformation

Truly Multi-lingual IDEs

https://youtu.be/50A9wjJ40Dk