58
1 DSLs with Groovy Saager Mhatre

Domain Specific Languages (DSLs) with Groovy [5th IndicThreads Conference On Java, 2010, Pune, India]

Embed Size (px)

Citation preview

Page 1: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

1

DSLs with Groovy Saager Mhatre

Page 2: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

2

github.com/dexterous

code.google.com/u/saager.mhatre

[email protected]

thinkaround.blogspot.com

@dexterous

Page 3: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

3

Page 4: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

4

The basic idea of a

domain specific languageis…

Page 5: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

5

…a computer languagethat's targeted to a particular kind of problem,

rather than a general purpose languagethat's aimed at any kind of software problem.

Martin Fowlerhttp://www.martinfowler.com/bliki/DomainSpecificLanguage.html

Page 6: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

6

… a computer programming languageof limited expressiveness

focused on a particular domain.Martin Fowler

Domain Specific Languages

Page 7: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

7

Chaar Banarasi Masala

Zardaa lagaa ke, Katri supaari

Tamaakhu jyaada, Gulkand kam

Page 8: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

8

Page 9: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

9

Page 10: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

10

http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html#enhance

Page 11: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

11

Excerpted from org.hamcrest.examples.junit4.ExampleWithAssertThat.java

Excerpted from http://code.google.com/p/logicalpractice-collections/wiki/GettingStarted

Page 12: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

12

the

popularity of DSLsis a result of…

Page 13: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

13

improved

developerproductivity

Page 14: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

14

better

domain-expertinteraction

Page 15: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

15

Page 16: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

16

Page 17: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

17

Page 18: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

18

Page 19: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

19

Page 20: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

20

Page 21: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

21

Page 22: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

22

Page 23: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

23

Page 24: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

24

Page 25: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

25

If a tree falls in a forest and no one is around to hear it, does it make a sound?

Page 26: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

26

If a Groovy enthusiast talks DSL in a conference and no one is interested in it,

does it help the software community?

Page 27: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

27

Page 28: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

28

If a Groovy enthusiast talks DSL in a conference and no one is interested in it,

does it help the software community?

Page 29: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

29

Page 30: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

30

Page 31: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

31

Page 32: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

32

Page 33: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

33

Page 34: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

34

Page 35: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

35

Page 36: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

36

Page 37: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

37

Page 38: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

38

Page 39: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

39

Page 40: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

40

Page 41: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

41

Page 42: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

42

Page 43: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

43

Page 44: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

44

Page 45: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

45

Page 46: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

46

Page 47: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

47

Page 48: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

48

Page 49: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

49

Page 50: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

50

Page 51: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

51

Page 52: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

52

Page 53: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

53

Page 54: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

54

Page 55: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

55

Page 56: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

56

Page 57: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

57

Page 58: Domain Specific Languages (DSLs) with Groovy  [5th IndicThreads Conference On Java, 2010, Pune, India]

58

github.com/dexterous

code.google.com/u/saager.mhatre

[email protected]

thinkaround.blogspot.com

@dexterous