• Keine Ergebnisse gefunden

Extensibility and Modularity
in Programming Languages

N/A
N/A
Protected

Academic year: 2022

Aktie "Extensibility and Modularity
in Programming Languages"

Copied!
22
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Seminar, WS 2017/18

Extensibility and Modularity
 in Programming Languages

17.10.2017 | Kick-off meeting

(2)
(3)

3

Basic research questions


How can we design and/or use programming languages best to
 extend a program:

in a safe way (types!)

without modifying existing code

More generally: How can we best group a program into modules and how can this be supported by the programming language/

system?

(4)

A little example (Java)

interface Expression { int evaluate();

String prettyPrint();

}

class Literal implements Expression { private int i;

public Literal(int i) { this.i = i; } public int evaluate() {

return i;

}

public String prettyPrint() { return i+““;

} }

(5)

5

A little example (Java)

Q: How can I add another kind of expression?

(6)

Easy:

A little example (Java)

interface Expression { int evaluate();

String prettyPrint();

}

class Literal implements Expression { … } class Addition implements Expression { private Expression e1, e2;

… /* Constructor omitted */

public int evaluate() {

return e1.evaluate() + e2.evaluate();

}

public String prettyPrint() {

return e1.prettyPrint() + ”+” +             e2.prettyPrint();

(7)

7

A little example (Java)

Q: How can I add another kind of operation on

expressions?

(8)

A little example (Java)

This is

not quite so easy,

though there are a number of attempts to solve this problem: Visitor pattern, Object algebras, … (We’ll learn more about them in the course of this seminar.)

However, it is easy to add new operations in

most FP languages, like Haskell.

(9)

9

A little example (Haskell)

Q (for those who know Haskell):

How would you realize our little example in

Haskell?

(10)

A little example (Haskell)

data Expr = Lit Int | Add Expr Expr eval :: Expr -> Int

eval (Lit i) = i

eval (Add e1 e2) = (eval e1) + (eval e2) pp :: Expr -> String

pp (Lit i) = show i pp (Add e1 e2) =

(show e1) ++ ”+” ++ (show e1)

(11)

11

A little example (Haskell)

Adding a new operation is easy:

data Expr = Lit Int | Add Expr Expr eval :: Expr -> Int

eval (Lit i) = i

eval (Add e1 e2) = (eval e1) + (eval e2) pp :: Expr -> String

pp (Lit i) = show i pp (Add e1 e2) =

(show e1) ++ ”+” ++ (show e1) depth :: Expr -> Int

depth (Lit i) = 0 depth (Add e1 e2) =

(maximum [depth e1, depth e2]) + 1

(12)

A little example (Haskell)

But: It is not so easy to add new variants of expressions — the situation is quite the

opposite from Java.

Again there are a number of attempts to solve this problem for FP languages like Haskell: Datatypes à la carte, …

(We’ll learn more about them in the course of this seminar.)

(13)

13

Expression Problem

What we saw is the canonical example for what is now called the Expression Problem (name due to P. Wadler)

How can we easily extend programs along both of the

extensibility dimensions: with both variants and operations ? There are many variations on the problem itself and on the

conditions under which we consider it solved:


type safety, various no-modification conditions, …

In this seminar: We study this matter in depth by reading some relevant research papers.

(14)

Credit Points, Structure, Grading, Time slot

(15)

15

Credit Points


3 ECTS for M.Sc. module INFO4244

4 ECTS under old PO 2010 (as Pflichtseminar)

(16)

Structure of course

Structure: Paper reading group with weekly meetings Each week: One student is the discussion leader who

• picks a research paper,

• familiarizes himself/herself in depth with its contents,

• prepares for the discussion and questions, and

• during the discussion: leads through the paper and keeps discussion on track.

The others also read the paper and prepare questions, and

• send these in due time before the meeting to me and the discussion leader.

At the end of the semester: Each participant writes a term paper on the topic he prepared for as discussion leader.

• More information on that will follow during the semester.

(17)

17

Grading

25% Participation as discussion leader 25% Participation in the other meetings 50% Term paper

(18)

Weekly meeting time slot?

Ideally this time slot (Tuesday 16 c.t.-18), but we can try to find a better one that works for all.

(19)

19

(20)

How to read a CS research paper?

Following P.W.L. Fong:


http://faculty.ksu.edu.sa/chikh/Documents/reading-paper.pdf When trying to first comprehend the paper, answer these q’s:

• What is the research problem that is addressed?

• What are the claimed contributions?

• How do the author(s) substantiate these claims?

• What are the conclusions? (What have we learned? What are open problems?)

A paper can be seen as telling a story, and its plot is structured by these four questions.

To then evaluate the paper, ask these questions:

• Is the research problem significant?

• Are the contributions significant?

(21)

21

More information

More general information on reading papers:

http://groups.csail.mit.edu/netmit/wordpress/wp-content/themes/

netmit/papers/HowtoRead.pdf

(22)

Contact:

Julian Jabs B221

Sand 13, 72076 Tübingen julian.jabs@uni-tuebingen.de

Referenzen

ÄHNLICHE DOKUMENTE

Our lack of knowledge about local conditions precluded determination of committee action effectiveness in fund allocation to those areas in greatest need of

HESKETH am Beispiel zweier Forschungsprojekte, welche Konsequenzen und Vorteile erwuchsen, weil ein Archivar im Forschungsteam mitarbeitete: "Die Forschenden waren veranlasst,

While the above mentioned concepts of archiving are mainly useful for different kinds of academic research, Dominique Le ROUX and Jean VIDAL report their experiences with

It is used to pass data, control and character generator information between the formatter and the printer controller.. A

- Check the volume horne block numFreeFileHeaders field for zero. - If the chain is unbroken then the freeFileHeaderNum field of the volume home block is set

If external lines are to be used then the corresponding port pins should be programmed as bit ports with the correct data direction. Finally, theCo~nter/Timer

This manual contains information on the GMX Micro-20 version of Technical Systems Consultants' UniFLEX Disk Operating.. information is specific to the GMX Micro-20

A breather filter on the drive housing cover reduces the ingress of contaminants through the bearings of the disk motor by minimising the pressure drop across