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
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?
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.
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
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"
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)
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)