1. Magritte
[René Magritte, 1966] Decalcomania
www.lukas-renggli.ch
Software Composition Group
University of Bern
2. Lukas Renggli
! Academics
– PhD Student, University of Bern
! Industry
– Independent Software Consultant
! Communities
– Core-developer of Seaside
– Author of Magritte and Pier
3. Agenda
! Introduction and Example
! History and Usage
! Implementation Details
! Adaptive Models
14. What is it used for?
! Reflection ! Object filtering
– Introspection ! Object serialization
– Intercession ! Object copying
! Viewer building ! Object indexing
! Editor building ! Object initialization
! Report building ! Object verification
! Documentation ! Object adaption
! Data validation ! Object customization
! Query processing
and much more ...
15. Why is it useful?
! Describe once, get everywhere.
! Extensibility of classes is ensured.
! Context dependent descriptions.
! End-user customizable.
! Developer configurable.
16. Why is it cool?
! Describe once, get everywhere.
! Be more productive.
! Lower coupling.
! Empower your users.
! Do more, with less code.
! Do more, with less hacking.
17. It seems a drag to me that you need to add 22 14 class
categories of Magritte, [...] I’d rather avoid Magritte. It’s a
PhD Master thesis, and so not optimized for simplicity.
People who use it, love it, I suppose. Probably makes
them feel smart.
— Chris Cunnington
19. SmallWiki started as
University Project
2002
SmallWiki
released
2003
1st price in
Started with SmallWiki 2 ESUG Innovation
(meta-model based) Technology Awards
2004
Changed development from
VisualWorks to Squeak
Extracted 1st commercial SqueakMap
Magritte Magritte Application release
2005
Changed product name from
SmallWiki to Pier
Magritte: Meta-Described
Web Application Development
2006
3rd price in
ESUG Innovation
seaside.st Technology Awards
2007
Magritte: A Meta-Driven Approach to
Empower Developers and End Users
Magritte
on WikiPedia
2008
26. Descriptions
! Problem
– Objects and their values all need to be treated
differently.
! Example
– Boolean and String are not polymorphic, therefore
different code for certain operations is necessary.
! Solution
– Introduce a descriptive hierarchy that can be
instantiated, configured and composed.
27. Type
Object
Component
Component
Type 1 *
1 1
(a) Type-Square
* *
Property
Property
Type 1 *
Type
Object
[Yoder et al, 2001] Architecture and design of adaptive object models
28. attributes
attributes
1 1 * attributes
*
1
Object *
Object *
*
Object
*
description
description
Object
Object
Type
Type
description
Object
Type
attributes
Description *
Description * *
1
Description
[Renggli et al, 2007] Magritte — A Meta-Driven Approach to Empower Developers and End Users *
29. attributes
attributes
1 1 * attributes
*
1
Object *
Object *
*
Object
*
description
description
Object
Object
Type
Type
description
Object
Type
attributes
Description *
Description * *
1
Description
[Renggli et al, 2007] Magritte — A Meta-Driven Approach to Empower Developers and End Users *
30. attributes
attributes
1 1 * attributes
*
1
Object *
Object *
*
Object
*
description
description
Object
Object
Type
Type
description
Object
Type
attributes
Description *
Description * *
1
Description
[Renggli et al, 2007] Magritte — A Meta-Driven Approach to Empower Developers and End Users *
31. Descriptions
Composite pattern
to describe model-instances.
Accessor Description Condition
children
Container ElementDesc.
StringDesc. BooleanDesc.
33. Accessors
! Problem
– Data can be stored and accessed in different ways.
! Examples
– Accessor methods, chains of accessor methods,
instance-variables, dictionaries, derived values,
external values, etc.
! Solution
– Provide a strategy pattern to be able to access data
through a common interface.
34. Accessors
Strategy pattern
to access model-entities.
next, accessor
Accessor
Cascade Selector Dictionary Block Null
Auto
35. o: Object d: Description a: Accessor
readUsing: d
accessor
read: o
<strategy a>
write: v using: d
accessor
write: v to: o
<strategy a>
36. Mementos
! Problems
– Editing might turn a model (temporarily) invalid.
– Canceling an edit shouldn’t change the model.
– Concurrent edits of the same model should be
detected and (manually) merged.
! Solution
– Introduce mementos that behave like the original
model and that delay modifications until they are
committed.
37. Mementos
Memento pattern
to cache model-entities.
description model
Description Memento Object
cache
Strait Cached Dictionary
original
Checked Dictionary