SlideShare a Scribd company logo
1 of 51
Download to read offline
Practical Models
   in Practice
   www.lukas-renggli.ch
Practical Models of
Models 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 Communities
 Seaside, Magritte and Pier
 Helvetia, PetitParser
Roadmap
1. Protocol Buffers
   Meta-data model for serialization
2. Magritte
   Meta-model for generic services
3. Google Web Toolkit
   Model-driven web architecture
4. Helvetia
   Meta-model for programming languages
Protocol Buffers
Meta-data model for serialization
Protocol Buffers

‣ Encode structured data
‣ Language-neutral
‣ Platform-neutral
‣ Extensible
‣ Efficient
Protocol Buffer IDL

message 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




                               C++
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);
Deserialize in Python


file = open("myfile", "rb")
person = Person()
person.ParseFromString(file.read())
file.close

print "Name: ", person.name
print "E-mail: ", person.email
Demo
Why not XML/JSON?

‣ Protocol Buffers are
 – 3—10 times smaller
 – 20—100 times faster
 – consistent code generators
 – less ambiguous
 – evolvable
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
‣ 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)
Magritte
Meta-model for generic services
Address Object


               :Address
    street = 'Schützenmattstrasse'
    plz = 3012
    place = 'Bern'
    canton = 'Bern'
Address Class


           :Address                        Address
street = 'Schützenmattstrasse'   class street: String
plz = 3012                             plz: Integer
place = 'Bern'                         place: String
canton = 'Bern'                        canton: String
Address Description

                                 Magritte                                 :StringDescription
                                                                   label = 'Street'

                                                                         :NumberDescription
                                                                   label = 'PLZ'
                                                                   required = true
           :Address                                                range = 1000..9999
street = 'Schützenmattstrasse'   description                              :StringDescription
                                                  :Container
plz = 3012                                                         label = 'Place'
                                               label = 'Address'
place = 'Bern'                                                     required = true
canton = 'Bern'
                                                                      :SingleOptionDescription
                                                                   label = 'Canton'
                                                                   required = true
                                                                   sorted = true
                                                                   options = #( 'Bern' 'Zurich' ... )
User Interfaces
result := anAddress asMorph
	 addButtons;
	 addWindow;
	 callInWorld
Web Interfaces
result := self call: (anAddress asComponent
	 addValidatedForm;
	 yourself)


                                 *

                                 *

                             *
Other Services
                    Reports
Viewers                                    Filtering
          Editors        Validation


Serialization                      Initialization
                 Indexing
      Copying             Initialization


   Extension                  Customization
                Adaptation
Meta-
              Metamodel




            <described-by>



              Metamodel



Developer
            <described-by>



            Domain Model



End User
Meta-
  Metamodel




<described-by>



  Metamodel


                  Magritte
                 Developer
<described-by>



Domain Model


                 Magritte
                 End User
Run- t im e

 Adaptive
Object Model
End users
customizability
Demo
Magritte

‣ Very powerful and flexible
‣ Runtime adaptive code
‣ End-user programmable code
‣ Can cause meta meta-confusion
‣ Can be slower than hardcoding
Google Web Toolkit
  Model-driven web architecture
Is this really a model?
    public class Main implements EntryPoint {
      public void onModuleLoad() {
        Label label = new Label(“Hello World”);
        RootPanel.add(label);
      }
    }
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
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
public class Main implements EntryPoint {
  public void onModuleLoad() {                platform
    Label label = new Label(“Hello World”);
    RootPanel.add(label);                     independent
  }
}                                             model



                                              model
                                              transformation
Transformation
            Mozilla   Chrome   Safari   IE   ...

 English

French

German

      ...
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
He vetia
         Helvetia
Meta-model for programming languages
Programming
  Language
    Model
ID	
  ::=	
  letter	
  {	
  letter	
  |	
  digit	
  }	
  ;




              a..z                 a..z
                                  0..9
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 ]
#(	#[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] )
ID	
  ::=	
  letter	
  {	
  letter	
  |	
  digit	
  }	
  ;




              a..z                 a..z
                                  0..9




                            44
ID	
  ::=	
  letter	
  {	
  letter	
  |	
  digit	
  }	
  ;


                    sequence

             letter              many

                                 choice

                         letter      digit


                            45
Extensible        sequence

             letter          many        Composable

                             choice
Transformable
                      letter     digit

                                Customizable
                        46
Editors                                    Code
                                              Highlighting

Contextual
                   He vetia
 Menus                                           Custom
                     sequence                   Inspector
Navigation
                letter            many              Search

   Code                           choice
                                                    Error
  Folding
                                                  Correction
                           letter     digit
      Code
    Expansion                                   Debuggers
                         Refactorings
                             47
Demo
He vetia
‣ Grammar is the meta-model
‣ Composable programming languages
‣ Extensible programming languages
‣ Tooling is built around the grammar
Structural    Behavioral
            Model         Model


Run-time
 Static
Run-time
Adaptive




                        He vetia
“Meta-models are the enablers of
practical software development.”

                               He vetia

        www.lukas-renggli.ch

More Related Content

What's hot

Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Vu Tran Lam
 
Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Jaroslaw Palka
 
Type Classes in Scala and Haskell
Type Classes in Scala and HaskellType Classes in Scala and Haskell
Type Classes in Scala and HaskellHermann Hueck
 
Refactoring-ch7 moving feature btw objects
Refactoring-ch7 moving feature btw objectsRefactoring-ch7 moving feature btw objects
Refactoring-ch7 moving feature btw objectsfungfung Chen
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...Doug Jones
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkDave Steinberg
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05CHOOSE
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1Philip Schwarz
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2Philip Schwarz
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editingDr. Jan Köhnlein
 
2011 10-24-initiatives-tracker-launch-v1.0
2011 10-24-initiatives-tracker-launch-v1.02011 10-24-initiatives-tracker-launch-v1.0
2011 10-24-initiatives-tracker-launch-v1.0tommyoneill
 
C,c++ interview q&a
C,c++ interview q&aC,c++ interview q&a
C,c++ interview q&aKumaran K
 
Javascript best practices
Javascript best practicesJavascript best practices
Javascript best practicesManav Gupta
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript ProgrammingSehwan Noh
 
Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)Hattori Sidek
 

What's hot (20)

Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)
 
C#
C#C#
C#
 
Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014
 
Type Classes in Scala and Haskell
Type Classes in Scala and HaskellType Classes in Scala and Haskell
Type Classes in Scala and Haskell
 
Refactoring-ch7 moving feature btw objects
Refactoring-ch7 moving feature btw objectsRefactoring-ch7 moving feature btw objects
Refactoring-ch7 moving feature btw objects
 
Scoping Tips and Tricks
Scoping Tips and TricksScoping Tips and Tricks
Scoping Tips and Tricks
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
 
Object-oriented Basics
Object-oriented BasicsObject-oriented Basics
Object-oriented Basics
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
 
2011 10-24-initiatives-tracker-launch-v1.0
2011 10-24-initiatives-tracker-launch-v1.02011 10-24-initiatives-tracker-launch-v1.0
2011 10-24-initiatives-tracker-launch-v1.0
 
Ch7 structures
Ch7 structuresCh7 structures
Ch7 structures
 
C,c++ interview q&a
C,c++ interview q&aC,c++ interview q&a
C,c++ interview q&a
 
Javascript best practices
Javascript best practicesJavascript best practices
Javascript best practices
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)
 
Monadic Java
Monadic JavaMonadic Java
Monadic Java
 

Viewers also liked

Choose'10: Uwe Zdun - Compliance in service-oriented architectures: A model-d...
Choose'10: Uwe Zdun - Compliance in service-oriented architectures: A model-d...Choose'10: Uwe Zdun - Compliance in service-oriented architectures: A model-d...
Choose'10: Uwe Zdun - Compliance in service-oriented architectures: A model-d...CHOOSE
 
Choose'10: Jean-Marie Favre - Domain and Technique Specific Languages – A Jou...
Choose'10: Jean-Marie Favre - Domain and Technique Specific Languages – A Jou...Choose'10: Jean-Marie Favre - Domain and Technique Specific Languages – A Jou...
Choose'10: Jean-Marie Favre - Domain and Technique Specific Languages – A Jou...CHOOSE
 
Services and Models in a Large IT System
Services and Models in a Large IT SystemServices and Models in a Large IT System
Services and Models in a Large IT SystemCHOOSE
 
Choose'10: Stephane Ducasse - Powerful DSL engineering in Smalltalk
Choose'10: Stephane Ducasse - Powerful DSL engineering in SmalltalkChoose'10: Stephane Ducasse - Powerful DSL engineering in Smalltalk
Choose'10: Stephane Ducasse - Powerful DSL engineering in SmalltalkCHOOSE
 
Security patterns and model driven architecture
Security patterns and model driven architectureSecurity patterns and model driven architecture
Security patterns and model driven architecturebdemchak
 
CPI, Inflation for Belize, July 2014 (PowerPoint)
CPI, Inflation for Belize, July 2014 (PowerPoint)CPI, Inflation for Belize, July 2014 (PowerPoint)
CPI, Inflation for Belize, July 2014 (PowerPoint)Adele Ramos
 
Ralph Jocham The Risks Of Scrum Handout
Ralph Jocham The Risks Of Scrum HandoutRalph Jocham The Risks Of Scrum Handout
Ralph Jocham The Risks Of Scrum HandoutCHOOSE
 
Hausi Müller - Towards Self-Adaptive Software-Intensive Systems
Hausi Müller - Towards Self-Adaptive Software-Intensive SystemsHausi Müller - Towards Self-Adaptive Software-Intensive Systems
Hausi Müller - Towards Self-Adaptive Software-Intensive SystemsCHOOSE
 
Self-adaptive Systems : An Introduction
Self-adaptive Systems : An Introduction Self-adaptive Systems : An Introduction
Self-adaptive Systems : An Introduction Sagar Sen
 
A White-box Perspective on Self-Adaptation and Self-Awareness (with a focus o...
A White-box Perspective on Self-Adaptation and Self-Awareness (with a focus o...A White-box Perspective on Self-Adaptation and Self-Awareness (with a focus o...
A White-box Perspective on Self-Adaptation and Self-Awareness (with a focus o...Alberto Lluch Lafuente
 
ACTRESS: Domain-Specific Modeling of Self-Adaptive Software Architectures
ACTRESS: Domain-Specific Modeling of Self-Adaptive Software ArchitecturesACTRESS: Domain-Specific Modeling of Self-Adaptive Software Architectures
ACTRESS: Domain-Specific Modeling of Self-Adaptive Software ArchitecturesFilip Krikava
 
201209 An Introduction to Building Affective-Driven Self-Adaptive Software
201209 An Introduction to Building Affective-Driven Self-Adaptive Software 201209 An Introduction to Building Affective-Driven Self-Adaptive Software
201209 An Introduction to Building Affective-Driven Self-Adaptive Software Javier Gonzalez-Sanchez
 

Viewers also liked (12)

Choose'10: Uwe Zdun - Compliance in service-oriented architectures: A model-d...
Choose'10: Uwe Zdun - Compliance in service-oriented architectures: A model-d...Choose'10: Uwe Zdun - Compliance in service-oriented architectures: A model-d...
Choose'10: Uwe Zdun - Compliance in service-oriented architectures: A model-d...
 
Choose'10: Jean-Marie Favre - Domain and Technique Specific Languages – A Jou...
Choose'10: Jean-Marie Favre - Domain and Technique Specific Languages – A Jou...Choose'10: Jean-Marie Favre - Domain and Technique Specific Languages – A Jou...
Choose'10: Jean-Marie Favre - Domain and Technique Specific Languages – A Jou...
 
Services and Models in a Large IT System
Services and Models in a Large IT SystemServices and Models in a Large IT System
Services and Models in a Large IT System
 
Choose'10: Stephane Ducasse - Powerful DSL engineering in Smalltalk
Choose'10: Stephane Ducasse - Powerful DSL engineering in SmalltalkChoose'10: Stephane Ducasse - Powerful DSL engineering in Smalltalk
Choose'10: Stephane Ducasse - Powerful DSL engineering in Smalltalk
 
Security patterns and model driven architecture
Security patterns and model driven architectureSecurity patterns and model driven architecture
Security patterns and model driven architecture
 
CPI, Inflation for Belize, July 2014 (PowerPoint)
CPI, Inflation for Belize, July 2014 (PowerPoint)CPI, Inflation for Belize, July 2014 (PowerPoint)
CPI, Inflation for Belize, July 2014 (PowerPoint)
 
Ralph Jocham The Risks Of Scrum Handout
Ralph Jocham The Risks Of Scrum HandoutRalph Jocham The Risks Of Scrum Handout
Ralph Jocham The Risks Of Scrum Handout
 
Hausi Müller - Towards Self-Adaptive Software-Intensive Systems
Hausi Müller - Towards Self-Adaptive Software-Intensive SystemsHausi Müller - Towards Self-Adaptive Software-Intensive Systems
Hausi Müller - Towards Self-Adaptive Software-Intensive Systems
 
Self-adaptive Systems : An Introduction
Self-adaptive Systems : An Introduction Self-adaptive Systems : An Introduction
Self-adaptive Systems : An Introduction
 
A White-box Perspective on Self-Adaptation and Self-Awareness (with a focus o...
A White-box Perspective on Self-Adaptation and Self-Awareness (with a focus o...A White-box Perspective on Self-Adaptation and Self-Awareness (with a focus o...
A White-box Perspective on Self-Adaptation and Self-Awareness (with a focus o...
 
ACTRESS: Domain-Specific Modeling of Self-Adaptive Software Architectures
ACTRESS: Domain-Specific Modeling of Self-Adaptive Software ArchitecturesACTRESS: Domain-Specific Modeling of Self-Adaptive Software Architectures
ACTRESS: Domain-Specific Modeling of Self-Adaptive Software Architectures
 
201209 An Introduction to Building Affective-Driven Self-Adaptive Software
201209 An Introduction to Building Affective-Driven Self-Adaptive Software 201209 An Introduction to Building Affective-Driven Self-Adaptive Software
201209 An Introduction to Building Affective-Driven Self-Adaptive Software
 

Similar to Practical Models in Practice

Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Andreas Dewes
 
The Dynamic Language is not Enough
The Dynamic Language is not EnoughThe Dynamic Language is not Enough
The Dynamic Language is not EnoughLukas Renggli
 
DITEC - Programming with C#.NET
DITEC - Programming with C#.NETDITEC - Programming with C#.NET
DITEC - Programming with C#.NETRasan Samarasinghe
 
Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#ANURAG SINGH
 
.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#Bertrand Le Roy
 
DISE - Windows Based Application Development in C#
DISE - Windows Based Application Development in C#DISE - Windows Based Application Development in C#
DISE - Windows Based Application Development in C#Rasan Samarasinghe
 
PDC Video on C# 4.0 Futures
PDC Video on C# 4.0 FuturesPDC Video on C# 4.0 Futures
PDC Video on C# 4.0 Futuresnithinmohantk
 
C++11: Feel the New Language
C++11: Feel the New LanguageC++11: Feel the New Language
C++11: Feel the New Languagemspline
 
02 direct3 d_pipeline
02 direct3 d_pipeline02 direct3 d_pipeline
02 direct3 d_pipelineGirish Ghate
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptEPAM Systems
 
Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language PerformanceKevin Hazzard
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...Sang Don Kim
 
A well-typed program never goes wrong
A well-typed program never goes wrongA well-typed program never goes wrong
A well-typed program never goes wrongJulien Wetterwald
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008Luis Enrique
 
Lecture # 1 introduction revision - 1
Lecture # 1   introduction  revision - 1Lecture # 1   introduction  revision - 1
Lecture # 1 introduction revision - 1SajeelSahil
 
Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids DDDx NYC 2014Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids DDDx NYC 2014Cyrille Martraire
 

Similar to Practical Models in Practice (20)

Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...
 
The Dynamic Language is not Enough
The Dynamic Language is not EnoughThe Dynamic Language is not Enough
The Dynamic Language is not Enough
 
DITEC - Programming with C#.NET
DITEC - Programming with C#.NETDITEC - Programming with C#.NET
DITEC - Programming with C#.NET
 
Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#
 
.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#
 
DISE - Windows Based Application Development in C#
DISE - Windows Based Application Development in C#DISE - Windows Based Application Development in C#
DISE - Windows Based Application Development in C#
 
PDC Video on C# 4.0 Futures
PDC Video on C# 4.0 FuturesPDC Video on C# 4.0 Futures
PDC Video on C# 4.0 Futures
 
Legacy is Good
Legacy is GoodLegacy is Good
Legacy is Good
 
C++11: Feel the New Language
C++11: Feel the New LanguageC++11: Feel the New Language
C++11: Feel the New Language
 
Introduction to Linq
Introduction to LinqIntroduction to Linq
Introduction to Linq
 
Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
02 direct3 d_pipeline
02 direct3 d_pipeline02 direct3 d_pipeline
02 direct3 d_pipeline
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScript
 
MongoDB 3.0
MongoDB 3.0 MongoDB 3.0
MongoDB 3.0
 
Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language Performance
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
 
A well-typed program never goes wrong
A well-typed program never goes wrongA well-typed program never goes wrong
A well-typed program never goes wrong
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
 
Lecture # 1 introduction revision - 1
Lecture # 1   introduction  revision - 1Lecture # 1   introduction  revision - 1
Lecture # 1 introduction revision - 1
 
Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids DDDx NYC 2014Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids DDDx NYC 2014
 

Practical Models in Practice

  • 1. Practical Models in Practice www.lukas-renggli.ch
  • 2. Practical Models of Models in Practice www.lukas-renggli.ch
  • 3. Practical Meta- Models in Practice www.lukas-renggli.ch
  • 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. Roadmap 1. Protocol Buffers Meta-data model for serialization 2. Magritte Meta-model for generic services 3. Google Web Toolkit Model-driven web architecture 4. Helvetia Meta-model for programming languages
  • 7. Protocol Buffers ‣ Encode structured data ‣ Language-neutral ‣ Platform-neutral ‣ Extensible ‣ Efficient
  • 8. Protocol Buffer IDL message Person {   required int32 id = 1;   required string name = 2;   optional string email = 3; }
  • 9. message Person {   required int32 id = 1;   required string name = 2;   optional string email = 3; } protoc C++
  • 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. Deserialize in Python file = open("myfile", "rb") person = Person() person.ParseFromString(file.read()) file.close print "Name: ", person.name print "E-mail: ", person.email
  • 12. Demo
  • 13. Why not XML/JSON? ‣ Protocol Buffers are – 3—10 times smaller – 20—100 times faster – consistent code generators – less ambiguous – evolvable
  • 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. ‣ 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)
  • 17. Address Object :Address street = 'Schützenmattstrasse' plz = 3012 place = 'Bern' canton = 'Bern'
  • 18. Address Class :Address Address street = 'Schützenmattstrasse' class street: String plz = 3012 plz: Integer place = 'Bern' place: String canton = 'Bern' canton: String
  • 19. Address Description Magritte :StringDescription label = 'Street' :NumberDescription label = 'PLZ' required = true :Address range = 1000..9999 street = 'Schützenmattstrasse' description :StringDescription :Container plz = 3012 label = 'Place' label = 'Address' place = 'Bern' required = true canton = 'Bern' :SingleOptionDescription label = 'Canton' required = true sorted = true options = #( 'Bern' 'Zurich' ... )
  • 20. User Interfaces result := anAddress asMorph addButtons; addWindow; callInWorld
  • 21. Web Interfaces result := self call: (anAddress asComponent addValidatedForm; yourself) * * *
  • 22. Other Services Reports Viewers Filtering Editors Validation Serialization Initialization Indexing Copying Initialization Extension Customization Adaptation
  • 23. Meta- Metamodel <described-by> Metamodel Developer <described-by> Domain Model End User
  • 24. Meta- Metamodel <described-by> Metamodel Magritte Developer <described-by> Domain Model Magritte End User
  • 25. Run- t im e Adaptive Object Model
  • 27. Demo
  • 28. Magritte ‣ Very powerful and flexible ‣ Runtime adaptive code ‣ End-user programmable code ‣ Can cause meta meta-confusion ‣ Can be slower than hardcoding
  • 29. Google Web Toolkit Model-driven web architecture
  • 30. Is this really a model? public class Main implements EntryPoint { public void onModuleLoad() { Label label = new Label(“Hello World”); RootPanel.add(label); } }
  • 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. 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. public class Main implements EntryPoint { public void onModuleLoad() { platform Label label = new Label(“Hello World”); RootPanel.add(label); independent } } model model transformation
  • 34. Transformation Mozilla Chrome Safari IE ... English French German ...
  • 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. He vetia Helvetia Meta-model for programming languages
  • 37.
  • 38.
  • 39.
  • 41. ID  ::=  letter  {  letter  |  digit  }  ; a..z a..z 0..9
  • 42. 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 ]
  • 43. #( #[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] )
  • 44. ID  ::=  letter  {  letter  |  digit  }  ; a..z a..z 0..9 44
  • 45. ID  ::=  letter  {  letter  |  digit  }  ; sequence letter many choice letter digit 45
  • 46. Extensible sequence letter many Composable choice Transformable letter digit Customizable 46
  • 47. Editors Code Highlighting Contextual He vetia Menus Custom sequence Inspector Navigation letter many Search Code choice Error Folding Correction letter digit Code Expansion Debuggers Refactorings 47
  • 48. Demo
  • 49. He vetia ‣ Grammar is the meta-model ‣ Composable programming languages ‣ Extensible programming languages ‣ Tooling is built around the grammar
  • 50. Structural Behavioral Model Model Run-time Static Run-time Adaptive He vetia
  • 51. “Meta-models are the enablers of practical software development.” He vetia www.lukas-renggli.ch