Implementation of Programming Languages · Reactive Programming and OO Languages •Reactive...
Transcript of Implementation of Programming Languages · Reactive Programming and OO Languages •Reactive...
Implementation of Programming Languages
Guido Salvaneschi
Jurgen Van Ham
Outline
• Administrivia
• Intro
• Schedule
• Topics
GENERAL INFORMATION
Administrivia
• Guido Salvaneschi, Jurgen van Ham
– Find us by email
– Office A213 / A207
– Group of Prof. Mira Mezini (STG)
Intro
• Implement a software artifact according to a given specification.
• General scope: programming languages:
– Extensions, code generators
– Tools, IDEs
– Analysis techniques
– Performance assessments
– Prototypes with innovative abstractions
Timeline
• Periodic discussions/meetings.
• Presentation and delivery of the artifact and the documentation: end of the semester.
Guidelines and Suggestions
• Depending on the goal of the project
• In general:
– Deliver RUNNING code
– Deliver some documentation
– Optional: final presentation / demo to discuss your work
• Teamworking is good!
– Organize a team even with people you don’t know (yet)
Grades
• Depending on the project
• Some guidelines:
– How much of the specification was implemented?
– Is the code working (the answer is YESOFCOURSE)
– What is the overall quality of the code?• E.g. is it painful to modify/extend it ?
• Is it self-documenting ?
– What is the quality of the documentation ?
Where to start
• Send me an email with your name and a list of 3 topics in order of preference.
• Or arrange an appointment:
– Ask clarifications if needed
– Discuss possible customizations
– Discuss the projects in more detail
– Consider your programming skills
• Topics will be assigned
• Discuss the project in detail with the instructor
Getting Widespread…
• Reactive programming in JavaScript– Flapjax, Bacon.js, Reactive.js, React.js, …
• Microsoft reactive extensions (Rx)
• REScala– www.rescala-lang.com
• Principles of Reactive Programming– Martin Odersky, Erik Meijer and Roland Kuhn
– https://www.coursera.org/course/reactive
RP in a Nutshell
• Reactivity in OO apps: Observer pattern
• In RP you can define constraints
– The framework enforces them for you
– Changes are automatically propagated
VIEWX Y Z
DATAX Y Z
val a = 3val b = 7val c := a + bval d := 2 * ca=4 println(c) // c==11 a b
c
d
TOPICS
Collection of examples for RP
• Create a suite of examples that cover the basics of reactive programming
• (Small!) Simulations
• Graphical interfaces
Enter a 3 character string:<input id="textField1"
style={! {borderColor: (extractValueB('textField1').length === 3 ? 'green' : 'red')}
!}/>
Scala Interface for Distributed RP
• DREAM: Distributed REActive PrograMming
• Provide a Scala reactive interface for DREAM !
– Analysis of Signal expressions
– Binding with remote objects
val a = Signal{ a() + b() }
Remote<Int> a = new Remote(“a + b”) DREAM
RESCALA
Case study for Join Languages
• Joins make concurrency easier!
– Wait for the second event
• Several proposals
– Polyphonic C# (Microsoft)
– Scala Joins
– JoCaml
• Evaluate this solution with a case study
Case study on efficient reactive programming
• Example from Simulink/Labview
• Implement the example using RP
• Compare performance and expressivity
RP in Java - DREAM
• Java 8 (finally!) has lambdas
• Extend Java to support signals and RP
– Polyglot/JustAdd extensible compilers
– Functional flavor + reactivity
Stream<Student> map = persons.stream().filter(p -> p.getAge() > 18).map(person -> new Student(person));
people.stream().
filter(p -> p.getGender() == Person.Gender.FEMALE).mapToInt(p -> p.getSalary()).
sum();
select sum(salary)from people
where gender = 'FEMALE'
SQL JAVA 8
Twitter Client
• Develop a simple twitter client with reactive programming
– Simple GUI
– Reactive abstractions• XML parsing
• Network communication
• User interaction
• Evaluate the use of reactive abstractions in the project
• Just an example, other case studies are possible
Session types in Scala
• Session types support static check of protocols correctness
• Steps
– Study session types
– Reuse existing library
– Small case study
Reactive Programming and OO Languages
• Reactive programming has been developed in the functional programming community
– How reactive abstractions, e.g. signals, behaviors, …, interact with OO features ?
• Develop a set of small examples/studies that investigate reactive programming in the OO domain
– Encapsulation
– Inheritance
– Information hiding
– ..
QUESTIONS?