Your SlideShare is downloading. ×
0
Practical Models   in Practice   www.lukas-renggli.ch
Practical Models ofModels in Practice    www.lukas-renggli.ch
Practical Meta-Models in Practice    www.lukas-renggli.ch
Lukas Renggli‣ Software Engineer at Google YouTube Video Analytics‣ SCG Alumni Bachelor, Master and PhD‣ Open-Source Commu...
Roadmap1. Protocol Buffers   Meta-data model for serialization2. Magritte   Meta-model for generic services3. Google Web To...
Protocol BuffersMeta-data model for serialization
Protocol Buffers‣ Encode structured data‣ Language-neutral‣ Platform-neutral‣ Extensible‣ Efficient
Protocol Buffer IDLmessage Person {  required int32 id = 1;  required string name = 2;  optional string email = 3;}
message Person {  required int32 id = 1;  required string name = 2;  optional string email = 3;}         protoc           ...
Serialize in C++Person person;person.set_name("John Doe");person.set_id(1234);person.set_email("jdoe@example.com");fstream...
Deserialize in Pythonfile = open("myfile", "rb")person = Person()person.ParseFromString(file.read())file.closeprint "Name:...
Demo
Why not XML/JSON?‣ Protocol Buffers are – 3—10 times smaller – 20—100 times faster – consistent code generators – less ambi...
message Person {               message Person {  required int32 id = 1;         required int32 id = 1;  required string na...
‣ Describe your data once, and use it  across platforms and languages‣ Evolution supported by design‣ Used at Google for a...
MagritteMeta-model for generic services
Address Object               :Address    street = Schützenmattstrasse    plz = 3012    place = Bern    canton = Bern
Address Class           :Address                        Addressstreet = Schützenmattstrasse   class street: Stringplz = 30...
Address Description                                 Magritte                                 :StringDescription           ...
User Interfacesresult := anAddress asMorph	 addButtons;	 addWindow;	 callInWorld
Web Interfacesresult := self call: (anAddress asComponent	 addValidatedForm;	 yourself)                                 * ...
Other Services                    ReportsViewers                                    Filtering          Editors        Vali...
Meta-              Metamodel            <described-by>              MetamodelDeveloper            <described-by>          ...
Meta-  Metamodel<described-by>  Metamodel                  Magritte                 Developer<described-by>Domain Model   ...
Run- t im e AdaptiveObject Model
End userscustomizability
Demo
Magritte‣ Very powerful and flexible‣ Runtime adaptive code‣ End-user programmable code‣ Can cause meta meta-confusion‣ Can...
Google Web Toolkit  Model-driven web architecture
Is this really a model?    public class Main implements EntryPoint {      public void onModuleLoad() {        Label label ...
Is this really a model?      public class Main implements EntryPoint {        public void onModuleLoad() {          Label ...
Is this really a model?      public class Main implements EntryPoint {        public void onModuleLoad() {          Label ...
public class Main implements EntryPoint {  public void onModuleLoad() {                platform    Label label = new Label...
Transformation            Mozilla   Chrome   Safari   IE   ... EnglishFrenchGerman      ...
GWT‣ Write JavaScript using a high-level widget  library in a well defined (statically typed)  language‣ Translate and opti...
He vetia         HelvetiaMeta-model for programming languages
Programming  Language    Model
ID	  ::=	  letter	  {	  letter	  |	  digit	  }	  ;              a..z                 a..z                                 ...
scanIdentifier	 self step.		 ((currentCharacter between: $A and: $Z) or:[ currentCharacter between: $a and: $z ]) ifTrue: [...
#(	#[1 0 9 0 25 0 13 0 34 0 17 0 40 0 21 0 41]	 #[1 0 9 0 25 0 13 0 34 0 93 0 76 0 157 0 112]	 #[1 2 38 0 21 2 38 0 25 2 3...
ID	  ::=	  letter	  {	  letter	  |	  digit	  }	  ;              a..z                 a..z                                 ...
ID	  ::=	  letter	  {	  letter	  |	  digit	  }	  ;                    sequence             letter              many       ...
Extensible        sequence             letter          many        Composable                             choiceTransforma...
Editors                                    Code                                              HighlightingContextual       ...
Demo
He vetia‣ Grammar is the meta-model‣ Composable programming languages‣ Extensible programming languages‣ Tooling is built ...
Structural    Behavioral            Model         ModelRun-time StaticRun-timeAdaptive                        He vetia
“Meta-models are the enablers ofpractical software development.”                               He vetia        www.lukas-r...
Practical Models in Practice
Practical Models in Practice
Practical Models in Practice
Upcoming SlideShare
Loading in...5
×

Practical Models in Practice

216

Published on

presented by Lukas Renggli at the CHOOSE Forum 2012

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
216
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Practical Models in Practice"

  1. 1. Practical Models in Practice www.lukas-renggli.ch
  2. 2. Practical Models ofModels in Practice www.lukas-renggli.ch
  3. 3. Practical Meta-Models in Practice www.lukas-renggli.ch
  4. 4. Lukas Renggli‣ Software Engineer at Google YouTube Video Analytics‣ SCG Alumni Bachelor, Master and PhD‣ Open-Source Communities Seaside, Magritte and Pier Helvetia, PetitParser
  5. 5. Roadmap1. Protocol Buffers Meta-data model for serialization2. Magritte Meta-model for generic services3. Google Web Toolkit Model-driven web architecture4. Helvetia Meta-model for programming languages
  6. 6. Protocol BuffersMeta-data model for serialization
  7. 7. Protocol Buffers‣ Encode structured data‣ Language-neutral‣ Platform-neutral‣ Extensible‣ Efficient
  8. 8. Protocol Buffer IDLmessage Person {  required int32 id = 1;  required string name = 2;  optional string email = 3;}
  9. 9. message Person {  required int32 id = 1;  required string name = 2;  optional string email = 3;} protoc C++
  10. 10. Serialize in C++Person person;person.set_name("John Doe");person.set_id(1234);person.set_email("jdoe@example.com");fstream output("myfile", ios::out | ios::binary);person.SerializeToOstream(&output);
  11. 11. Deserialize in Pythonfile = open("myfile", "rb")person = Person()person.ParseFromString(file.read())file.closeprint "Name: ", person.nameprint "E-mail: ", person.email
  12. 12. Demo
  13. 13. Why not XML/JSON?‣ Protocol Buffers are – 3—10 times smaller – 20—100 times faster – consistent code generators – less ambiguous – evolvable
  14. 14. message Person { message Person {  required int32 id = 1;   required int32 id = 1;  required string name = 2;   required string name = 2;  optional string email = 3;   repeated string email = 3;} repeated Phone phone = 4; } :Person :Person :Person
  15. 15. ‣ Describe your data once, and use it across platforms and languages‣ Evolution supported by design‣ Used at Google for almost all – data storage (file formats, database) – remote procedure protocols (RPC)
  16. 16. MagritteMeta-model for generic services
  17. 17. Address Object :Address street = Schützenmattstrasse plz = 3012 place = Bern canton = Bern
  18. 18. Address Class :Address Addressstreet = Schützenmattstrasse class street: Stringplz = 3012 plz: Integerplace = Bern place: Stringcanton = Bern canton: String
  19. 19. Address Description Magritte :StringDescription label = Street :NumberDescription label = PLZ required = true :Address range = 1000..9999street = Schützenmattstrasse description :StringDescription :Containerplz = 3012 label = Place label = Addressplace = Bern required = truecanton = Bern :SingleOptionDescription label = Canton required = true sorted = true options = #( Bern Zurich ... )
  20. 20. User Interfacesresult := anAddress asMorph addButtons; addWindow; callInWorld
  21. 21. Web Interfacesresult := self call: (anAddress asComponent addValidatedForm; yourself) * * *
  22. 22. Other Services ReportsViewers Filtering Editors ValidationSerialization Initialization Indexing Copying Initialization Extension Customization Adaptation
  23. 23. Meta- Metamodel <described-by> MetamodelDeveloper <described-by> Domain ModelEnd User
  24. 24. Meta- Metamodel<described-by> Metamodel Magritte Developer<described-by>Domain Model Magritte End User
  25. 25. Run- t im e AdaptiveObject Model
  26. 26. End userscustomizability
  27. 27. Demo
  28. 28. Magritte‣ Very powerful and flexible‣ Runtime adaptive code‣ End-user programmable code‣ Can cause meta meta-confusion‣ Can be slower than hardcoding
  29. 29. Google Web Toolkit Model-driven web architecture
  30. 30. Is this really a model? public class Main implements EntryPoint { public void onModuleLoad() { Label label = new Label(“Hello World”); RootPanel.add(label); } }
  31. 31. Is this really a model? public class Main implements EntryPoint { public void onModuleLoad() { Label label = new Label(“Hello World”); RootPanel.add(label); } }High-level Widgets
  32. 32. Is this really a model? public class Main implements EntryPoint { public void onModuleLoad() { Label label = new Label(“Hello World”); RootPanel.add(label); } }High-level Description Widgets Language
  33. 33. public class Main implements EntryPoint { public void onModuleLoad() { platform Label label = new Label(“Hello World”); RootPanel.add(label); independent }} model model transformation
  34. 34. Transformation Mozilla Chrome Safari IE ... EnglishFrenchGerman ...
  35. 35. GWT‣ Write JavaScript using a high-level widget library in a well defined (statically typed) language‣ Translate and optimize code towards specific browsers‣ Debugging actually works nowadays
  36. 36. He vetia HelvetiaMeta-model for programming languages
  37. 37. Programming Language Model
  38. 38. ID  ::=  letter  {  letter  |  digit  }  ; a..z a..z 0..9
  39. 39. scanIdentifier self step. ((currentCharacter between: $A and: $Z) or:[ currentCharacter between: $a and: $z ]) ifTrue: [ [ self recordMatch: #IDENTIFIER. self step. (currentCharacter between: $0 and: $9)or: [ (currentCharacter between: $A and: $Z) or:[ currentCharacter between: $a and: $z ] ] ] whileTrue. ^ self reportLastMatch ]
  40. 40. #( #[1 0 9 0 25 0 13 0 34 0 17 0 40 0 21 0 41] #[1 0 9 0 25 0 13 0 34 0 93 0 76 0 157 0 112] #[1 2 38 0 21 2 38 0 25 2 38 0 26 0 13 0 34] #[0 1 154 0 16 0 21 0 25 0 26 0 34 0 40 0 41] #[0 1 210 0 76 0 81] #[0 1 214 0 76 0 81] #[1 0 173 0 76 0 177 0 81] #[0 1 134 0 16 0 21 0 25 0 26 0 34 0 40 0 41] #[1 1 46 0 21 1 46 0 25 1 46 0 26 1 69] #[1 1 54 0 21 1 54 0 25 1 54 0 26 1 54 0 34] #[0 2 102 0 21 0 25 0 26 0 34 0 40 0 41 0 76] #[0 2 50 0 21 0 25 0 26 0 76 0 79] #[1 1 13 0 76 2 85 0 124 1 21 0 125] #[1 2 89 0 17 2 30 0 21 2 30 0 82] #[1 2 93 0 21 2 97 0 82] )
  41. 41. ID  ::=  letter  {  letter  |  digit  }  ; a..z a..z 0..9 44
  42. 42. ID  ::=  letter  {  letter  |  digit  }  ; sequence letter many choice letter digit 45
  43. 43. Extensible sequence letter many Composable choiceTransformable letter digit Customizable 46
  44. 44. Editors Code HighlightingContextual He vetia Menus Custom sequence InspectorNavigation letter many Search Code choice Error Folding Correction letter digit Code Expansion Debuggers Refactorings 47
  45. 45. Demo
  46. 46. He vetia‣ Grammar is the meta-model‣ Composable programming languages‣ Extensible programming languages‣ Tooling is built around the grammar
  47. 47. Structural Behavioral Model ModelRun-time StaticRun-timeAdaptive He vetia
  48. 48. “Meta-models are the enablers ofpractical software development.” He vetia www.lukas-renggli.ch
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×