The Dynamic Languageis not Enough
Lukas Renggli
Static Software
Static Software
Constant
Static Software
Constant
Fixed
Static Software
Constant
FixedFinal
Dynamic Software
Dynamic Software
Adaptive
Dynamic Software
Adaptive
Extensible
Dynamic Software
Adaptive
Customizable
Extensible
StaticLanguage
DynamicLanguage
Static
Softw
are
Dyn
amic
Softw
are
:-(
StaticLanguage
DynamicLanguage
Static
Softw
are
Dyn
amic
Softw
are
:-(
:-|
StaticLanguage
DynamicLanguage
Static
Softw
are
Dyn
amic
Softw
are
:-|
StaticLanguage
Dyn
amic
Softw
are
:-|
StaticLanguage
Dyn
amic
Softw
are
:-(
:-|
StaticLanguage
DynamicLanguage
Static
Softw
are
Dyn
amic
Softw
are
:-(
:-|
:-S
StaticLanguage
DynamicLanguage
Static
Softw
are
Dyn
amic
Softw
are
:-S
DynamicLanguage
Static
Softw
are
no support
easier
can always get
away with reflection
faster
don’t know how to do it
too complex
out-of-the-box
:-(
:-|
:-S
:-)
StaticLanguage
DynamicLanguage
Static
Softw
are
Dyn
amic
Softw
are
:-)
DynamicLanguage
Dyn
amic
Softw
are
1
Subclassing
2
Extending
3
Meta-Modeling
4
Meta Meta-Modeling
5
Composing
6
Transforming
Subclassing
2
Extending
3
Meta-Modeling
4
Meta Meta-Modeling
5
Composing
6
Transforming
Subclassing Extending
3
Meta-Modeling
4
Meta Meta-Modeling
5
Composing
6
Transforming
Subclassing Extending
Meta-Modeling
4
Meta Meta-Modeling
5
Composing
6
Transforming
Subclassing Extending
Meta-Modeling Meta Meta-Modeling
5
Composing
6
Transforming
Subclassing Extending
Meta-Modeling Meta Meta-Modeling
Composing
6
Transforming
Subclassing Extending
Meta-Modeling Meta Meta-Modeling
Composing TransformingHe vetia
1Subclassing
The framework for developing sophisticated web applications in Smalltalk
Add new functionality by adding a new subclass.
WAComponent
renderContentOn:
WAComponent
renderContentOn:
MyComponent
renderContentOn:
Template Method
ExtensibleCustomizable
Adaptable
WAToolPlugin
labelexecute
WANewSession... WATiming...
WAToolPlugin
labelexecute
...
WAToolPlugin
labelexecuteallPlugins
self allSubclassescollect: [ :each | each new ]
WAHaloPlugin
labelexecuteallPlugins
self allSubclassescollect: [ :each | each new ]
Discussion
‣ Template Method Pattern
‣ Simple
‣ Lightweight
‣ Portable
‣ No extra infrastructure
Other Users
‣ Monticello Repository Types
‣ OmniBrowser Commands
‣ Code Critics Rules
‣ TextLint Rules (later today)
‣ Pier Commands, Views, Structures
‣ Magritte Description Types
2Extending
Add new functionality by adding a new method.
menuCommandOn: aBuilder <worldMenu>
(aBuilder item: 'Shout Workspace') parent: #Tools; action: [ self open ]
menuCommandOn: aBuilder <worldMenu>
(aBuilder item: 'Shout Workspace') parent: #Tools; action: [ self open ]
PragmaCollector allSystemPragmas select: [ :each | each keyword = #worldMenu ]
}
Discussion
‣ Simple
‣ Lightweight
‣ Long utility methods
‣ Encourages class-extensions
Alternatives to Pragmas
‣ Naming convention for selector names
‣ Naming convention for protocol names
‣ All methods of a specific class
Other Users
‣ Pier Value Links
‣ Pharo Compiler Primitives, System Settings
‣ OmniBrowser Commands, Obsolete Commands, and Browser Meta-Model
3Meta-Modeling
Create a first-class description of the domain.
Environment
Environment Category
Environment Category
Environment
Class
Comment
Metaclass
Category
Environment
Class
Comment
MetaclassProtocol
CategoryAllProtocol
Environment
Class
Comment
MetaclassProtocol
MethodCategoryAllProtocol
OB-Web
OB-Mars
Discussion
‣ UI independent
‣ Domain-specific reflection
‣ Extensible using subclassing/extending
‣ Can cause meta-confusion
‣ Can be limiting or slow
Other Users
‣ GLORP Relational Object Mapping
‣ Glamour Browser Model
‣ Monticello Code Model
‣ Announcement Event Model
‣ Magritte Meta-Model
4Meta Meta-Modeling
Create a first-class description of the description of the
domain.
Address Object
street = 'Schützenmattstrasse'plz = 3012place = 'Bern'canton = 'Bern'
:Address
Address Description
street = 'Schützenmattstrasse'plz = 3012place = 'Bern'canton = 'Bern'
:Address
label = 'Street'
:StringDescription
label = 'PLZ'required = truerange = 1000..9999
:NumberDescription
label = 'Place'required = true
:StringDescription
label = 'Canton'required = truesorted = trueoptions = #( 'Bern' 'Zurich' ... )
:SingleOptionDescription
label = 'Address'
:Containerdescription
result := anAddress asMorph addButtons; addWindow; callInWorld
Morphic Interpreter
result := self call: (anAddress asComponent addValidatedForm; yourself).
Seaside Interpreter
*
**
Other “Interpreters”‣ Viewer building
‣ Editor building
‣ Report building
‣ Documentation
‣ Data validation
‣ Query processing
‣ Object filtering
‣ Object serialization
‣ Object copying
‣ Object indexing
‣ Object initialization
‣ Object extension
‣ Object adaption
‣ Object customization
and much more ...
Domain Model
Metamodel
Meta-
Metamodel
<described-by>
<described-by>
Developer
End User
Domain Model
Metamodel
Meta-
Metamodel
Magritte
Developer
<described-by>
<described-by>
Magritte
End User
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) MagritteComponent
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) MagritteComponent
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) MagritteComponent
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Component
TypeComponent
Property
TypeProperty
1 *
1
*
*1
*
1
Type Object
Type Object
(a) Type-Square
Object
Description
Typ
e
Ob
ject
*
*
descrip
tio
n
attributes
1 *
(b) Magritte
Adaptive Object Model
Run-time
End userscustomizability
Demo
Discussion
‣ Very powerful and flexible
‣ Runtime adaptive code
‣ End-user programmable code
‣ Can cause meta meta-confusion
‣ Can be slow
Other Users
‣ Gjallar Issue Tracker
‣ DabbleDB Online Database
5Composing
Build something new by composing existing
parts.
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] )
ScannerlessParser Combinator
a..z a..z
0..9
ID ::= letter { letter | digit } ;
letter
letter digit
sequence
choice
many
ID ::= letter { letter | digit } ;
letter
letter digit
sequence
choice
many
id := #letter , (#letter / #digit) star
letter
letter digit
sequence
choice
many
id := #letter asParser , (#letter asParser / #digit asParser) star
Smalltalk
+ SQL Language
+ Regular Expression
= Customized Smalltalk
Discussion
‣ The LEGO model
‣ New parts can be easily created
‣ Smalltalk provides elegant composition with binary operators
Other Users
‣ Brazil Widgets in Newspeak
‣ Seaside and Pier Widgets
‣ Refactoring Engine Change Objects
6Transforming
He vetia
Build something new by transforming existing
parts.
LanguageScope
LanguageConcern
LanguageChange
LanguageBox
Language Scope
Active?
Language Scope
‣ System
‣ Packages
‣ Classes
‣ Methods
Language Scope
Language Concern
Semantics
Language Concern
Transformation
Language Concern
Context Menus
Navigation Search
Code Expansion
Code Completion
Error Correction
Custom Inspector
Refactorings
Code Folding
Highlighting
Code Execution
Language Change
Syntax
Language Change
Smalltalk
Language Change
Smalltalk
+ SQL Language
Language Change
Smalltalk
+ SQL Language
+ Regular Expression
Smalltalk
+ SQL Language
+ Regular Expression
= Custom Host Language
Language Change
Demo
Discussion
‣ Very generic and powerful
‣ Usually requires extra infrastructure (for example Helvetia)
‣ Might be difficult to learn and apply
Other Users
‣ Refactoring Engine Rewrite Rules
‣ Compiler Hacks (ok, not really)
‣ XML, XSD Transformations
‣ SOUL, IntensiVE
?Anything Else?
‣ Subclassing
‣ Extending
‣ Meta-Modeling
‣ Meta Meta-Modeling
‣ Composing
‣ Transforming}How to make “tools”
and “languages” extensible?
How to make the “object model” extensible?
AlbedoJorge Ressia
Object
Class
Object
StructuralMeta-object
Class
Object
StructuralMeta-object
Class
BehavioralMeta-object
:-(
:-|
:-S
:-)
StaticLanguage
DynamicLanguage
Static
Softw
are
Dyn
amic
Softw
are
:-)lukas-renggli.ch
@renggli
Dynamic Software