SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
Moldable meta-models for
Moose
Pavel Krivanek, Inria Nord Europe, RMoD
Moose
● platform for software and data analysis
● free & open source
● modeling
● measuring
● mining
● importing
● parsing
● building interactive and visual analysis tools
● powered by Pharo
FAMIX
● language independent meta-model
● basic meta-model for Moose
● represents in a uniform way multiple object-
oriented and procedural languages
● cover several programming paradigms
Smalltalk
Java
C++
Ada
Language meta-models
FAMIX
several redesigns
described by FAME
(meta-circular meta-
meta-model)
FAMIX
● methods in Type?
● inheritance in Type?
● comment on every Sourced entity?
● annotation on every Named entity?
● because of what language is it like this?
Custom meta-model - SQL
● Aggregate
● Column
● ColumnGroup
● ColumnToColumnAssociation
● ColumnToFunctionAssociation
● DBAccess
● DBAccessGroup
● DataBase
● DefaultValueConstraint
● DeleteRequest
● ExpressionToColumnAssociation
● ExpressionToFunctionAssociation
● FKAssociationGroup
● FKToPKAssociation
● FamixSQLAPICreation
● FunctionToAggregateAssociation
● FunctionToColumnAssociation
● FunctionToFunctionAssociation
● FunctionToTableAssociation
●
● Index
● InsertRequest
● Mapping
● MappingGroup
● PGSQLSourceLanguage
● RelationalEntity
● Request
● SQLConstraint
● SQLDefaultConstraintGroup
● SQLDependencyTrackerTest
● SQLExpression
● SQLFunction
● SQLIndex
● SQLIndexGroup
● SQLIndexing
● SQLInheritance
● SQLInheritanceGroup
● SQLSourceLanguage
● SelectRequest
● Sequence
● TEntityCreator
● Table
● TableGroup
● Trigger
● TriggerGroup
● UpdateRequest
● View
● ViewGroup
● ViewToAggregateAssociation
● ViewToColumnAssociation
● ViewToFunctionAssociation
● ViewToTableAssociation
Custom meta-models
● adopt your meta-model on FAMIX
● add entities
● define relations, new associations
● add properties to existing entities (e.g. named
entity – maps, privateState)
● extend tools
Custom meta-models
● meta-models for new language – rare?
● DSL, structured data
● simplified custom task-specific meta-models
● e.g. only class hierarchy and methods
● MooseImportingContext
Multiple inheritance
● Useful in some meta-models
● e.g. Java method = TypedEntity + Container
● Traits in Pharo
– packages cannot extend method definition
– stateless
FAMIX – definition of relations
FAMIXContainerEntity subclass: #FAMIXBehaviouralEntity
instanceVariableNames: 'parameters'
classVariableNames: ''
package: 'Famix-Core'
parameters
<MSEProperty: #parameters type: #FAMIXParameter
opposite: #parentBehaviouralEntity> <multivalued>
<derived>
<MSEComment: 'List of formal parameters declared by
this behaviour.'>
^parameters
parameters: param
parameters value: param
initialize
super initialize.
parameters := FMNullMultivalueLink on: self opposite:
#parentBehaviouralEntity: selector: #parameters.
FAMIX – definition of relations
FAMIXStructuralEntity subclass: #FAMIXParameter
instanceVariableNames: 'parentBehaviouralEntity'
classVariableNames: ''
package: 'Famix-Core'
parentBehaviouralEntity
<MSEProperty: #parentBehaviouralEntity type: #FAMIXBehaviouralEntity opposite:
#parameters>
<MSEComment: 'Behavioural entity containing this parameter. belongsTo
implementation'>
<container>
^parentBehaviouralEntity
parentBehaviouralEntity: aBehaviouralEntity
parentBehaviouralEntity := FMMultivalueLink on: self
update: #parameters
from: self parentBehaviouralEntity
to: aBehaviouralEntity.
initialize
super initialize.
parentBehaviouralEntity := nil.
New FAMIX meta-model
● cover more different languages
● general base for custom meta-models
● simpler relations management
● multiple inheritance
● support for huge models
● better memory & speed efficiency
Modern Pharo features
● benefit from:
– slots
– new traits
Slots
● since Pharo 3
● still not widely used
● slot ≈ instance variable + accessors logic
TypedSlot
Object subclass: #TypedSlotExample
slots: { #bool => TypedSlot for: Boolean default: true.
#point => TypedSlot for: {Point. UndefinedObject} }
classVariables: { }
category: 'TypedSlot-Tests'
bool
^ bool
bool: anObject
bool := anObject
TypedSlot
InstanceVariableSlot subclass: #TypedSlot
emitValue: aMethodBuilder
aMethodBuilder
pushLiteralVariable: #slot -> self;
pushReceiver;
send: #read:
read: anObject
| slotValue |
slotValue := thisContext object: anObject instVarAt: index.
self check: slotValue.
^ slotValue
21 <40> pushLit: slot
22 <70> self
23 <E1> send: read:
24 <7C> returnTop
Relation slot
● old: FMMultivalueLink
● new: FMSlotMultivalueLink
FAMIXContainerEntity subclass: #FAMIXBehaviouralEntity
slots: { #parameters => FMMany type: #FAMIXParameter opposite: #parent }
classVariables: { }
category: 'Famix-Core'
FAMIXStructuralEntity subclass: #FAMIXParameter
slots: { #parent => FMOne type: #FAMIXBehaviouralEntity opposite: #parameters }
classVariables: { }
category: 'Famix-General-Parameters'
Relation slot
● no more need for FMNullMultivalueLink
● only simple accessors needed
● relations visible in the class definition
● access to not restricted to accessors calls
Relation slot
● FMOne – FMOne
● FMOne – FMMany
● FMMany – FMOne
● FMMany – FMMany
● relation between instances, not classes
● FMOne - direct value
● FMMany - basic collections protocol
(FMSlotMultivalueLink)
Relation slot – next properties
● keep clean class definitions
● add pragmas to the getter (like before)
accessor
<MSEComment: 'Entity making the access to the variable'>
<source>
^ accessor
Traits
● a set of methods that can be used to extend the
functionality of a class
● since Squeak 3.9
● only stateless
● FAMIX is all about STATE
Pharo Traits
● implementation:
– do not exist from the VM perspective
– VM sees 2nd inst. var. of Behavior (methodDict)
– user sees #localMethods or #methods
– similar to hiding of instance variables:
SystemWindow instanceVariables size "18"
SystemWindow instSize "27"
Pharo metaclasses
Traits
metaclass := Metaclass new.
metaclass
superclass: superMetaclass;
slots: classSlots.
newClass := metaclass new.
newClass
superclass: superclass
slots: slots.
Class builder:
Alternative Metaclass?
● Crazy (but old) idea:
– what about to use an alternative Metaclasses?
– traits implementations as a optional libraries
● standard Pharo traits
● stateful traits
● talents
● automatic accessors
● optional parameters
● …
Alternative Metaclass?
● Metaclass defines behavior of metaclasses
Metaclass>>#methods
->
Object class methods
How to do:
Object methods ???
How to do slots?
AlternativeMetaclass
metaclass := Metaclass new.
metaclass
superclass: superMetaclass;
slots: classSlots.
newClass := metaclass new.
newClass
superclass: superclass
slots: slots.
Class builder:
Solution:
alternative Metaclass + new class builder
Traits V2
● Pablo Tesone
● work in progress
● traits flattened in the kernel of Pharo 7
● huge task
– stabilization
– clean current API
– new class definition (extendable by packages)
– adapt the system and tools
Stateful traits
● end of year 2017(?)
● but we need stateful traits now!
● how to design new FAMIX without them?
Stateful traits
● solution:
– simulation
– all traits flattened
– all slots flattened
– traits manager, system announcemnts
– based on implementation of Talents (Pablo Tesone)
Stateful traits
FmxJavaNamespace class>>#statefulTraits
<statefulTraits>
^ { FmxTNamespace }
StatefulTraitsManager uniqueInstance manageAllFromPragmas.
StatefulTraitsManager uniqueInstance cleanAll.
● class definition extendable by packages (extension
methods)
Simple relations
● Defined by two traits
FmxTraitEntity subclass: #FmxTComment
slots: { #container => FMOne type: #FmxTWithComments opposite: #comments. }
FmxTraitEntity subclass: #FmxTWithComments
slots: { #comments => FMMany type: #FmxTComment opposite: #container }
Associations
● Defined by three traits
FmxTraitEntity subclass: #FmxTAccess
slots: { #accessor => FMOne type: #FmxTWithAccesses opposite: #accesses.
#variable => FMOne type: #FmxTAccessible opposite: #incomingAccesses. }
FmxTraitEntity subclass: #FmxTAccessible
slots: { #incomingAccesses => FMMany type: #FmxTAccess opposite: #variable }
FmxTraitEntity subclass: #FmxTWithAccesses
slots: { #accesses => FMMany type: #FmxTAccess opposite: #accessor }
SomeClass>>#message
^ var
Object subclass: #SomeClass
instanceVariableNames: 'var'
classVariableNames: ''
package: 'SomePackage'
Relations
Relations
#FmxTAccess #FmxTAccessible #FmxTAnnotationInstance #FmxTAnnotationInstanceAttribute
#FmxTAnnotationType #FmxTAnnotationTypeAttribute #FmxTAssociation #FmxTAttribute
#FmxTCaughtException #FmxTComment #FmxTCompilationUnit #FmxTDeclaredException
#FmxTDereferencedInvocation #FmxTEnumValue #FmxTException #FmxTFile #FmxTFileAnchor
#FmxTFileInclude #FmxTFunction #FmxTGlobalVariable #FmxTGlobalVariableScope #FmxTHeader
#FmxTImplicitVariable #FmxTInvocable #FmxTInvocation #FmxTInvocationsReceiver
#FmxTLocalVariable #FmxTMethod #FmxTModule #FmxTNamed #FmxTNamespace
#FmxTNamespaceEntity #FmxTPackage #FmxTPackageable #FmxTParameter
#FmxTParameterizedType #FmxTParameterizedTypeUser #FmxTPreprocessorDefine
#FmxTPreprocessorIfdef #FmxTReference #FmxTReferenceable #FmxTScopingEntity
#FmxTSourceAnchor #FmxTSourceLanguage #FmxTSub #FmxTSubInheritance #FmxTSuper
#FmxTSuperInheritance #FmxTTemplate #FmxTTemplateUser #FmxTThrownException #FmxTTrait
#FmxTType #FmxTTypeAlias #FmxTTypedAnnotationInstance #FmxTTypedAnnotationInstanceAttribute
#FmxTTypedStructure #FmxTWithAccesses #FmxTWithAnnotationInstanceAttributes
#FmxTWithAnnotationInstances #FmxTWithAnnotationTypes #FmxTWithAttributes
#FmxTWithCaughtExceptions #FmxTWithClassScope #FmxTWithComments #FmxTWithCompilationUnit
#FmxTWithDeclaredExceptions #FmxTWithDereferencedInvocations #FmxTWithEnumValues
#FmxTWithExceptions #FmxTWithFileInclude #FmxTWithFiles #FmxTWithFunctions #FmxTWithHeader
#FmxTWithImplicitVariables #FmxTWithInvocations #FmxTWithLocalVariables #FmxTWithMethods
#FmxTWithModule #FmxTWithNamespaces #FmxTWithPackages #FmxTWithParameterizedTypeUsers
#FmxTWithParameterizedTypes #FmxTWithParameters #FmxTWithReferences #FmxTWithSignature
#FmxTWithSourceAnchor #FmxTWithSourceLanguage #FmxTWithSubInheritances
#FmxTWithSuperInheritances #FmxTWithTemplates #FmxTWithThrownExceptions #FmxTWithTrait
#FmxTWithTypeAliases #FmxTWithTypedStructures #FmxTWithTypes #FmxTraitEntity
Flat hierarchy vs tree
Flat hierarchy vs tree
Flat hierarchy vs tree
● let user decide
● predefined flattened classes for the common
universal entities
– FmxUnivSourceAnchor
– FmxUnivSourceLanguage
– FmxUnivSourcedEntity
– FmxUnivComment
– …
FmxMethod allStatefulTraits size >>> 26
Containers
● elements can be in multiple containers
– method: in class, in package
● FAMIX containers – language independent
● introduce primary container
– tree structure
– unique for language
– importing context
– easier model navigation
Containers
● can be forced by trait by annotation in the getter (as before)
●
primary container
– traits define #potentialContaners, #potentialPrimaryContainer
● predefined for traits with single relation slot
– define for every element
●
probably introduce next kinds of containers (Cyril Ferlicot)
– technical container (e.g. SourceAnchor)
– logical container (e.g. File)
FmxStMethod class>>#containerTraits
^ {FmxTPackageable. FmxTMethod}
FmxStMethod class>>#primaryContainerTrait
^ FmxTMethod
Memory savings
● big models are very expensive
● slots do not bring significant direct space saving
● savings from language-specific meta-models
● simplified meta-models, importing contexts
● ~25% on ArgoUML-0.34.mse (Java)
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
yohanbeschi
 
Logging and Exception
Logging and ExceptionLogging and Exception
Logging and Exception
Azeem Mumtaz
 
Владимир Иванов. Java 8 и JVM: что нового в HotSpot
Владимир Иванов. Java 8 и JVM: что нового в HotSpotВладимир Иванов. Java 8 и JVM: что нового в HotSpot
Владимир Иванов. Java 8 и JVM: что нового в HotSpot
Volha Banadyseva
 

Was ist angesagt? (20)

Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
 
Logging and Exception
Logging and ExceptionLogging and Exception
Logging and Exception
 
Java 9 features
Java 9 featuresJava 9 features
Java 9 features
 
The Next Generation MOP, Jochen Theodorou, GR8Conf 2013
The Next Generation MOP, Jochen Theodorou, GR8Conf 2013 The Next Generation MOP, Jochen Theodorou, GR8Conf 2013
The Next Generation MOP, Jochen Theodorou, GR8Conf 2013
 
Shiksharth com java_topics
Shiksharth com java_topicsShiksharth com java_topics
Shiksharth com java_topics
 
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw  est prêt à tuer le classpathSoft-Shake 2016 : Jigsaw  est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
 
Владимир Иванов. Java 8 и JVM: что нового в HotSpot
Владимир Иванов. Java 8 и JVM: что нового в HotSpotВладимир Иванов. Java 8 и JVM: что нового в HotSpot
Владимир Иванов. Java 8 и JVM: что нового в HotSpot
 
Invoke dynamics
Invoke dynamicsInvoke dynamics
Invoke dynamics
 
Lambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian GoetzLambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian Goetz
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France
 
Groovy AST Demystified
Groovy AST DemystifiedGroovy AST Demystified
Groovy AST Demystified
 
Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test tools
 
Groovy AST Transformations
Groovy AST TransformationsGroovy AST Transformations
Groovy AST Transformations
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
JVM
JVMJVM
JVM
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
 
Bytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMBytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASM
 
Spring boot
Spring bootSpring boot
Spring boot
 

Ähnlich wie Moldable meta-models for Moose

Whoops! where did my architecture go?
Whoops! where did my architecture go?Whoops! where did my architecture go?
Whoops! where did my architecture go?
Oliver Gierke
 
Using SP Metal for faster share point development
Using SP Metal for faster share point developmentUsing SP Metal for faster share point development
Using SP Metal for faster share point development
Pranav Sharma
 

Ähnlich wie Moldable meta-models for Moose (20)

Moose Meta-Modeling Infrastructure
Moose Meta-Modeling InfrastructureMoose Meta-Modeling Infrastructure
Moose Meta-Modeling Infrastructure
 
Maf3 - Part 1
Maf3 - Part 1Maf3 - Part 1
Maf3 - Part 1
 
Meta Object Protocols
Meta Object ProtocolsMeta Object Protocols
Meta Object Protocols
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules Restructured
 
Eclipse meets e4
Eclipse meets e4Eclipse meets e4
Eclipse meets e4
 
Some tips to improve developer experience with Symfony
Some tips to improve developer experience with SymfonySome tips to improve developer experience with Symfony
Some tips to improve developer experience with Symfony
 
Whoops! where did my architecture go?
Whoops! where did my architecture go?Whoops! where did my architecture go?
Whoops! where did my architecture go?
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
 
Zendcon zray
Zendcon zrayZendcon zray
Zendcon zray
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talk
 
Using SP Metal for faster share point development
Using SP Metal for faster share point developmentUsing SP Metal for faster share point development
Using SP Metal for faster share point development
 
Código Saudável => Programador Feliz - Rs on Rails 2010
Código Saudável => Programador Feliz - Rs on Rails 2010Código Saudável => Programador Feliz - Rs on Rails 2010
Código Saudável => Programador Feliz - Rs on Rails 2010
 
Terraform training 🎒 - Basic
Terraform training 🎒 - BasicTerraform training 🎒 - Basic
Terraform training 🎒 - Basic
 
Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?
 
SAS Macro
SAS MacroSAS Macro
SAS Macro
 
Using SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint developmentUsing SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint development
 
Famix Next-Generation
Famix Next-GenerationFamix Next-Generation
Famix Next-Generation
 
Extensible markup language attacks
Extensible markup language attacksExtensible markup language attacks
Extensible markup language attacks
 
Generics and collections in Java
Generics and collections in JavaGenerics and collections in Java
Generics and collections in Java
 

Mehr von ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
ESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG
 

Mehr von ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Kürzlich hochgeladen

JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
Max Lee
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 

Kürzlich hochgeladen (20)

A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdfStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdfMicrosoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
 
OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdf
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
APVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purityAPVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purity
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
AI Hackathon.pptx
AI                        Hackathon.pptxAI                        Hackathon.pptx
AI Hackathon.pptx
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 

Moldable meta-models for Moose

  • 1. Moldable meta-models for Moose Pavel Krivanek, Inria Nord Europe, RMoD
  • 2. Moose ● platform for software and data analysis ● free & open source ● modeling ● measuring ● mining ● importing ● parsing ● building interactive and visual analysis tools ● powered by Pharo
  • 3. FAMIX ● language independent meta-model ● basic meta-model for Moose ● represents in a uniform way multiple object- oriented and procedural languages ● cover several programming paradigms
  • 5. FAMIX several redesigns described by FAME (meta-circular meta- meta-model)
  • 6. FAMIX ● methods in Type? ● inheritance in Type? ● comment on every Sourced entity? ● annotation on every Named entity? ● because of what language is it like this?
  • 7. Custom meta-model - SQL ● Aggregate ● Column ● ColumnGroup ● ColumnToColumnAssociation ● ColumnToFunctionAssociation ● DBAccess ● DBAccessGroup ● DataBase ● DefaultValueConstraint ● DeleteRequest ● ExpressionToColumnAssociation ● ExpressionToFunctionAssociation ● FKAssociationGroup ● FKToPKAssociation ● FamixSQLAPICreation ● FunctionToAggregateAssociation ● FunctionToColumnAssociation ● FunctionToFunctionAssociation ● FunctionToTableAssociation ● ● Index ● InsertRequest ● Mapping ● MappingGroup ● PGSQLSourceLanguage ● RelationalEntity ● Request ● SQLConstraint ● SQLDefaultConstraintGroup ● SQLDependencyTrackerTest ● SQLExpression ● SQLFunction ● SQLIndex ● SQLIndexGroup ● SQLIndexing ● SQLInheritance ● SQLInheritanceGroup ● SQLSourceLanguage ● SelectRequest ● Sequence ● TEntityCreator ● Table ● TableGroup ● Trigger ● TriggerGroup ● UpdateRequest ● View ● ViewGroup ● ViewToAggregateAssociation ● ViewToColumnAssociation ● ViewToFunctionAssociation ● ViewToTableAssociation
  • 8. Custom meta-models ● adopt your meta-model on FAMIX ● add entities ● define relations, new associations ● add properties to existing entities (e.g. named entity – maps, privateState) ● extend tools
  • 9. Custom meta-models ● meta-models for new language – rare? ● DSL, structured data ● simplified custom task-specific meta-models ● e.g. only class hierarchy and methods ● MooseImportingContext
  • 10. Multiple inheritance ● Useful in some meta-models ● e.g. Java method = TypedEntity + Container ● Traits in Pharo – packages cannot extend method definition – stateless
  • 11. FAMIX – definition of relations FAMIXContainerEntity subclass: #FAMIXBehaviouralEntity instanceVariableNames: 'parameters' classVariableNames: '' package: 'Famix-Core' parameters <MSEProperty: #parameters type: #FAMIXParameter opposite: #parentBehaviouralEntity> <multivalued> <derived> <MSEComment: 'List of formal parameters declared by this behaviour.'> ^parameters parameters: param parameters value: param initialize super initialize. parameters := FMNullMultivalueLink on: self opposite: #parentBehaviouralEntity: selector: #parameters.
  • 12. FAMIX – definition of relations FAMIXStructuralEntity subclass: #FAMIXParameter instanceVariableNames: 'parentBehaviouralEntity' classVariableNames: '' package: 'Famix-Core' parentBehaviouralEntity <MSEProperty: #parentBehaviouralEntity type: #FAMIXBehaviouralEntity opposite: #parameters> <MSEComment: 'Behavioural entity containing this parameter. belongsTo implementation'> <container> ^parentBehaviouralEntity parentBehaviouralEntity: aBehaviouralEntity parentBehaviouralEntity := FMMultivalueLink on: self update: #parameters from: self parentBehaviouralEntity to: aBehaviouralEntity. initialize super initialize. parentBehaviouralEntity := nil.
  • 13. New FAMIX meta-model ● cover more different languages ● general base for custom meta-models ● simpler relations management ● multiple inheritance ● support for huge models ● better memory & speed efficiency
  • 14. Modern Pharo features ● benefit from: – slots – new traits
  • 15. Slots ● since Pharo 3 ● still not widely used ● slot ≈ instance variable + accessors logic
  • 16. TypedSlot Object subclass: #TypedSlotExample slots: { #bool => TypedSlot for: Boolean default: true. #point => TypedSlot for: {Point. UndefinedObject} } classVariables: { } category: 'TypedSlot-Tests' bool ^ bool bool: anObject bool := anObject
  • 17. TypedSlot InstanceVariableSlot subclass: #TypedSlot emitValue: aMethodBuilder aMethodBuilder pushLiteralVariable: #slot -> self; pushReceiver; send: #read: read: anObject | slotValue | slotValue := thisContext object: anObject instVarAt: index. self check: slotValue. ^ slotValue 21 <40> pushLit: slot 22 <70> self 23 <E1> send: read: 24 <7C> returnTop
  • 18. Relation slot ● old: FMMultivalueLink ● new: FMSlotMultivalueLink FAMIXContainerEntity subclass: #FAMIXBehaviouralEntity slots: { #parameters => FMMany type: #FAMIXParameter opposite: #parent } classVariables: { } category: 'Famix-Core' FAMIXStructuralEntity subclass: #FAMIXParameter slots: { #parent => FMOne type: #FAMIXBehaviouralEntity opposite: #parameters } classVariables: { } category: 'Famix-General-Parameters'
  • 19. Relation slot ● no more need for FMNullMultivalueLink ● only simple accessors needed ● relations visible in the class definition ● access to not restricted to accessors calls
  • 20. Relation slot ● FMOne – FMOne ● FMOne – FMMany ● FMMany – FMOne ● FMMany – FMMany ● relation between instances, not classes ● FMOne - direct value ● FMMany - basic collections protocol (FMSlotMultivalueLink)
  • 21. Relation slot – next properties ● keep clean class definitions ● add pragmas to the getter (like before) accessor <MSEComment: 'Entity making the access to the variable'> <source> ^ accessor
  • 22. Traits ● a set of methods that can be used to extend the functionality of a class ● since Squeak 3.9 ● only stateless ● FAMIX is all about STATE
  • 23. Pharo Traits ● implementation: – do not exist from the VM perspective – VM sees 2nd inst. var. of Behavior (methodDict) – user sees #localMethods or #methods – similar to hiding of instance variables: SystemWindow instanceVariables size "18" SystemWindow instSize "27"
  • 25. Traits metaclass := Metaclass new. metaclass superclass: superMetaclass; slots: classSlots. newClass := metaclass new. newClass superclass: superclass slots: slots. Class builder:
  • 26. Alternative Metaclass? ● Crazy (but old) idea: – what about to use an alternative Metaclasses? – traits implementations as a optional libraries ● standard Pharo traits ● stateful traits ● talents ● automatic accessors ● optional parameters ● …
  • 27. Alternative Metaclass? ● Metaclass defines behavior of metaclasses Metaclass>>#methods -> Object class methods How to do: Object methods ??? How to do slots?
  • 28. AlternativeMetaclass metaclass := Metaclass new. metaclass superclass: superMetaclass; slots: classSlots. newClass := metaclass new. newClass superclass: superclass slots: slots. Class builder: Solution: alternative Metaclass + new class builder
  • 29. Traits V2 ● Pablo Tesone ● work in progress ● traits flattened in the kernel of Pharo 7 ● huge task – stabilization – clean current API – new class definition (extendable by packages) – adapt the system and tools
  • 30. Stateful traits ● end of year 2017(?) ● but we need stateful traits now! ● how to design new FAMIX without them?
  • 31. Stateful traits ● solution: – simulation – all traits flattened – all slots flattened – traits manager, system announcemnts – based on implementation of Talents (Pablo Tesone)
  • 32. Stateful traits FmxJavaNamespace class>>#statefulTraits <statefulTraits> ^ { FmxTNamespace } StatefulTraitsManager uniqueInstance manageAllFromPragmas. StatefulTraitsManager uniqueInstance cleanAll. ● class definition extendable by packages (extension methods)
  • 33. Simple relations ● Defined by two traits FmxTraitEntity subclass: #FmxTComment slots: { #container => FMOne type: #FmxTWithComments opposite: #comments. } FmxTraitEntity subclass: #FmxTWithComments slots: { #comments => FMMany type: #FmxTComment opposite: #container }
  • 34. Associations ● Defined by three traits FmxTraitEntity subclass: #FmxTAccess slots: { #accessor => FMOne type: #FmxTWithAccesses opposite: #accesses. #variable => FMOne type: #FmxTAccessible opposite: #incomingAccesses. } FmxTraitEntity subclass: #FmxTAccessible slots: { #incomingAccesses => FMMany type: #FmxTAccess opposite: #variable } FmxTraitEntity subclass: #FmxTWithAccesses slots: { #accesses => FMMany type: #FmxTAccess opposite: #accessor } SomeClass>>#message ^ var Object subclass: #SomeClass instanceVariableNames: 'var' classVariableNames: '' package: 'SomePackage'
  • 36. Relations #FmxTAccess #FmxTAccessible #FmxTAnnotationInstance #FmxTAnnotationInstanceAttribute #FmxTAnnotationType #FmxTAnnotationTypeAttribute #FmxTAssociation #FmxTAttribute #FmxTCaughtException #FmxTComment #FmxTCompilationUnit #FmxTDeclaredException #FmxTDereferencedInvocation #FmxTEnumValue #FmxTException #FmxTFile #FmxTFileAnchor #FmxTFileInclude #FmxTFunction #FmxTGlobalVariable #FmxTGlobalVariableScope #FmxTHeader #FmxTImplicitVariable #FmxTInvocable #FmxTInvocation #FmxTInvocationsReceiver #FmxTLocalVariable #FmxTMethod #FmxTModule #FmxTNamed #FmxTNamespace #FmxTNamespaceEntity #FmxTPackage #FmxTPackageable #FmxTParameter #FmxTParameterizedType #FmxTParameterizedTypeUser #FmxTPreprocessorDefine #FmxTPreprocessorIfdef #FmxTReference #FmxTReferenceable #FmxTScopingEntity #FmxTSourceAnchor #FmxTSourceLanguage #FmxTSub #FmxTSubInheritance #FmxTSuper #FmxTSuperInheritance #FmxTTemplate #FmxTTemplateUser #FmxTThrownException #FmxTTrait #FmxTType #FmxTTypeAlias #FmxTTypedAnnotationInstance #FmxTTypedAnnotationInstanceAttribute #FmxTTypedStructure #FmxTWithAccesses #FmxTWithAnnotationInstanceAttributes #FmxTWithAnnotationInstances #FmxTWithAnnotationTypes #FmxTWithAttributes #FmxTWithCaughtExceptions #FmxTWithClassScope #FmxTWithComments #FmxTWithCompilationUnit #FmxTWithDeclaredExceptions #FmxTWithDereferencedInvocations #FmxTWithEnumValues #FmxTWithExceptions #FmxTWithFileInclude #FmxTWithFiles #FmxTWithFunctions #FmxTWithHeader #FmxTWithImplicitVariables #FmxTWithInvocations #FmxTWithLocalVariables #FmxTWithMethods #FmxTWithModule #FmxTWithNamespaces #FmxTWithPackages #FmxTWithParameterizedTypeUsers #FmxTWithParameterizedTypes #FmxTWithParameters #FmxTWithReferences #FmxTWithSignature #FmxTWithSourceAnchor #FmxTWithSourceLanguage #FmxTWithSubInheritances #FmxTWithSuperInheritances #FmxTWithTemplates #FmxTWithThrownExceptions #FmxTWithTrait #FmxTWithTypeAliases #FmxTWithTypedStructures #FmxTWithTypes #FmxTraitEntity
  • 39. Flat hierarchy vs tree ● let user decide ● predefined flattened classes for the common universal entities – FmxUnivSourceAnchor – FmxUnivSourceLanguage – FmxUnivSourcedEntity – FmxUnivComment – … FmxMethod allStatefulTraits size >>> 26
  • 40. Containers ● elements can be in multiple containers – method: in class, in package ● FAMIX containers – language independent ● introduce primary container – tree structure – unique for language – importing context – easier model navigation
  • 41. Containers ● can be forced by trait by annotation in the getter (as before) ● primary container – traits define #potentialContaners, #potentialPrimaryContainer ● predefined for traits with single relation slot – define for every element ● probably introduce next kinds of containers (Cyril Ferlicot) – technical container (e.g. SourceAnchor) – logical container (e.g. File) FmxStMethod class>>#containerTraits ^ {FmxTPackageable. FmxTMethod} FmxStMethod class>>#primaryContainerTrait ^ FmxTMethod
  • 42. Memory savings ● big models are very expensive ● slots do not bring significant direct space saving ● savings from language-specific meta-models ● simplified meta-models, importing contexts ● ~25% on ArgoUML-0.34.mse (Java)