1 Domain-Specific Modeling for Full Code Generation Juha-Pekka Tolvanen, Ph.D. MetaCase September 2010
2 -UML - -DSM
3
4
5 The entire history of software engineering is that of the rise in levels of abstraction C++ UML *Software Productivity Research & Capers Jones, 2002
DSM Percent Increase 1000 % 1000 % ( ) 900 % 900 % 800 % 750 % 700 % 600 % 500 % 500 % 600 % 500 % 600 % 400 % 300 % 200 % 100 % 0 % Embedded UI applications Mobile phone software Phone switch features Call processing services Heart rate monitor J2EE web application J2EE Web Home automation Domains 6
7 DSM Model Code Finished product
DSM Model CASE Simulink Labview Model Code Code? Finished product Finished product? 8
9 DSM Model CASE Simulink Labview Model 'Model' Code Code? Code Finished product Finished product? Finished product
UML UML 10 DSM Model CASE Simulink Labview Model 'Model' 'Model' Code Code? Code Code Finished product Finished product? Finished product Finished product
UML OMG 10 MDA 11 DSM Model CASE Simulink Labview Model 'Model' 'Model' MDA Model 2n Code Code? Code Code Code Finished product Finished product? Finished product Finished product Finished product
12 DSM Code Model DSM Finished product Code 'Model' Finished product Code 'Model' Finished product MDA Code Model Finished product Model 2 Model n CASE Simulink Labview Code Finished product Model?? Code Model Finished product 2 CASE
Domain Idea Solve problem in domain terms C UML UML Model Code Assembler Finished Product No need to map! DSM 13
14 Domain Idea :,,,,,,,,, Model-View-Controller http://ja.wikipedia.org/wiki/model_view_controller Finished Product No need to map! DSM
15
16 DSM:
DSM : : : / / / 17
/ 8 4 1 2 Analysis Design Coding Maintenance Defect distribution and costs* *Molina, P., Introducing MDD, Code Generation Conference 2010 18
19
20
21
22
23 Life style Life style
24 Life style Life style
25 IMS SIP HTTP :
26
27
28
29
30 B.Braun; Medical Dialysis machines Bell Labs / AT&T / Lucent; 5ESS telecommunications switch, EADS: Tetra terminals Panasonic: embedded UI Honeywell; embedded software architectures Polar Electro: heart rate monitors ORGA; SIM toolkit & JavaCard Pecunet; B2B E-Business: insurance LexiFi; mlfi, financial contracts DuPont; Activity Modeling NASA ASE group; Amphion NASA JPL; embedded measurement systems Nokia; Mobile Phone product line USAF; Message Transformation and Validation http://www.dsmforum.org/cases.html DSM www.dsmforum.org
31 Experiences from practice
32 Building your modeling language
Domain Idea Solve problem in domain terms C UML UML Model Code Assembler Finished Product No need to map! DSM 33
34 Domain Idea DSM Finished Product DSM Easy! Model in DSM language Generate code Domain Framework
DSM 1. 2. 3. 4. 35
36 DSM environment DOMAIN- SPECIFIC Modeling LANGUAGE DOMAIN- SPECIFIC CODE GENERATOR DOMAIN FRAMEWORK
37 DSM Initial analysis suggested five approaches: 1. 2. 3. 4. 5.
1. 38
2. DSL XML As opposed to generic 3GL 39
40 3. HW FA
41 4. UI Power of relationships
5. http://www.metacase.com/blogs/jpt/blogview?showcomments=true&entry=3388313102 DSM UI 42
43 A object A relationship A role A property Property Role Relationship Role Property Object Object
Small example: 44
Syringe broken, operator died, patient treatment error http://www.fuji-setsu.co.jp/products/metaedit/metaedit_hands_on.html 45
46 01 move(-3); filt(1); suck(5); 02 move(4); filt(0); blow(2); 03 move(1); blow(3); 04 move(-3); suck(30); 05 move(1); blow(30);
47 Version 1 move(-3); filt(1); suck(5); move(4); filt(0); blow(2); move(1); blow(3); move(-3); suck(30); move(1); blow(30);
48 Version 1:
Version 1: 49
50 Version 1: Object Object move(-3); filt(1); suck(5); move(4); filt(0); blow(2); move(1); blow(3); move(-3); suck(30); move(1); blow(30);
51 01 move(-3); filt(1); suck(5); 02 move(4); filt(0); blow(2); 03 move(1); blow(3); 04 move(-3); suck(30); 05 move(1); blow(30);
52 Version 2: 01 move(-3); filt(1); suck(5); 02 move(4); filt(0); blow(2); 03 move(1); blow(3); 04 move(-3); suck(30); 05 move(1); blow(30);
53 Version 2: : Take, Put, Clean : Move : Take
12 objects 11 relationships 24 properties 47 elements in total 5 objects 4 relationship 7 properties 16 elements in total 54
55 Version 2: Take (Abstract) Put Take Put Take Put Needle Clean Put
56
and, or, start, stop 57
58
59 Building a Generator How generators work? How to design a generator? Generator example
60 1. 2. 3. 4. Three generator approaches (Simulink Labview ) DSM environment DOMAIN- SPECIFIC Modeling LANGUAGE DOMAIN- SPECIFIC CODE GENERATOR DOMAIN FRAMEWORK
1 ( good looking ) 61
62 2
63 "Here's one I made earlier"
autobuild Autobuild = 1. 2. 3. 64
65 Domain Framework http://www.fuji-setsu.co.jp/files/framework.pdf
66
Model Generated code Non-generated 67
68 Where to apply and how?
69 Where to apply?
70 DSM
71 MetaEdit+ DSM 1 2 3 4
72 MetaEdit+ DSM 1 2 3 4
MetaEdit+: DSM (,, ),,,,, 73
DSM Eclipse EMF, Eclipse GEF DSM 1. 2. 3. 4. 5. 6. (MetaEdit+) DSM DSM DSML http://www.metacase.com/ja/featurelist.html 74
DSM Eclipse GMF, Microsoft DSL tools DSM 1. 2. 3. 4. 5. 6. (MetaEdit+) DSM DSM DSML http://www.metacase.com/ja/featurelist.html 75
DSM DSM 1. GME MetaEdit 1.0 2. 3. 4. 5. 6. (MetaEdit+) DSM DSM DSML http://www.metacase.com/ja/featurelist.html 76
DSM 63 XML 60 C, HTML, 36 Assembler 77 Python 143 J2EE Java / http://www.fuji-setsu.co.jp/products/metaedit/blogs.html 77
78 DSM " Antti Raunio MetaEdit+ DSL Jukka Manninen MetaEdit+ Eclipse GMF " Ulf Hesselbarth MetaEdit+ David Narraway
79 DSM DSM MetaEdit+ DSM DSM The ultimate refactoring!
80 Further reading
81 Further reading
82 MetaEdit+
83 Windows Linux Solaris HP-UX Mac OS X 1. SOAP Web 2. 3.
84
85 DSM : : : App units 30 25 20 15 10 5 0 App units in month Current DSM 1 2 3 4 5 6 Month
86 : ROI : 75% : 6 12 34 148 170 000 740 000 2 500 10 000 6700% 7300% 6 30 000 1 DSM 1 250 DSM 31 250 DSM 25 DSM 1 250
87 DSM MetaEdit+ 15 100
USA: MetaCase 5605 North MacArthur Blvd. 11th Floor, Irving, Texas 75038 Phone (972) 819-2039 Fax (480) 247-5501 jpt@metacase.com www.metacase.com Europe: MetaCase Ylistönmäentie 31 FI-40500 Jyväskylä, Finland Phone +358 14 641 000 Fax +358 420 648 606 当 浅 E-MAIL info@fuji-setsu.co.jp www.fuji-setsu.co.jp 88