The document describes Scl, a Simple Component Language for component-oriented programming in Smalltalk. Scl aims to be simple, uniform, and operational. It defines components as black boxes with ports, and allows their composition through connectors. Connectors reify connections and enable adaptation. Scl also supports aspect-oriented programming through special connectors. Properties allow publish-subscribe communication between components by notifying of state changes. The language has been prototyped in Smalltalk to experiment with its concepts.
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
SCL
1. Scl :
a Simple, Uniform and Operational Language
for Component-Oriented Programming
in Smalltalk
Luc Fabresse Christophe Dony Marianne Huchard
LIRMM
Universit´e Montpellier 2
France
September 3, 2006
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 1 / 32
2. Outline
1 Context
2 A Short Overview of Scl
3 The Connection Mechanism
4 AOP Support Using Connectors
5 Publish/Subscribe Support Using Properties
6 Conclusions
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 2 / 32
3. Outline
1 Context
2 A Short Overview of Scl
3 The Connection Mechanism
4 AOP Support Using Connectors
5 Publish/Subscribe Support Using Properties
6 Conclusions
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 3 / 32
4. The High-Level View of CBSD
Component
Component Library
Application
Programmer Architect
creates
stored used
D
A
D
creates
B
A C
D
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 4 / 32
5. Current Issues in CBSD
Fundamental Questions
What is a component? [Szyperski, 1996]
Component structure?
Component composition?
Practical Needs
Models
Languages
Tools
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 5 / 32
6. Outline
1 Context
2 A Short Overview of Scl
3 The Connection Mechanism
4 AOP Support Using Connectors
5 Publish/Subscribe Support Using Properties
6 Conclusions
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 6 / 32
7. Simple Component Language (Scl)
What is Scl?
A component-oriented programming language
Main purposes of Scl
Simple, few and only fundamental entities
Uniform, not an asymmetric extension of an object-oriented language
Enables unanticipated composition of independently developed
components
Synthesis of existing component-oriented languages ideas
Operationnal, implemented in Smalltalk
Extensible to experiment new ideas
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 7 / 32
8. Basic Entities (1/2)
Component
Black box
Ports decribed by interfaces
Provides and requires services
Port
Interaction point
Plug
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 8 / 32
9. Basic Entities (1/2)
Service
Functionnality
Like a method or a set of methods
Interface
Describes the valid uses of a port
Service signatures sets, protocols, contracts, ...
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 9 / 32
11. 1 Context
2 A Short Overview of Scl
3 The Connection Mechanism
4 AOP Support Using Connectors
5 Publish/Subscribe Support Using Properties
6 Conclusions
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 11 / 32
12. The Connector entity
Connector = Reification of Connection
Better separation
Non-fixed connection semantics
Solves adaptation problems
Possible creation of a reusable library of connectors
The General Connector Structure
Sources, a set of ports
Targets, a set of ports
Glue code
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 12 / 32
13. A Graphical View of a Connector
<<SclConnector>>
Required Provided
Ports
glue code
Sources Targets
Ports
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 13 / 32
14. Example: Connection of two matching components
<<SclBinaryConnector>>
Chatting
Source
ConnectionManager
Target
ChatClient
Networking Networking
SclBinaryConnector new
source: ( chatClient port: #Networking )
target: ( connectionManager port: #Networking ) ;
connect
Similar to:
bindings in Fractal
connect primitive in Archjava
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 14 / 32
17. 1 Context
2 A Short Overview of Scl
3 The Connection Mechanism
4 AOP Support Using Connectors
5 Publish/Subscribe Support Using Properties
6 Conclusions
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 17 / 32
21. 1 Context
2 A Short Overview of Scl
3 The Connection Mechanism
4 AOP Support Using Connectors
5 Publish/Subscribe Support Using Properties
6 Conclusions
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 21 / 32
22. Motivating Example (1/2)
How to connect a chatclient component with a GUI component ?
Chatting
Accessing
chatText
chatText:
displayText
displayText:
ChatClient
Networking
TextArea
Accessing
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 22 / 32
23. Motivating Example (2/2)
How to connect a chatclient component with a GUI component ?
ChatClient
Networking
Notifying
TextArea
Accessing
chatTextChanged:
Chatting
Accessing
chatText
chatText:
displayText
displayText:
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 23 / 32
24. The limitations with components
Publisher side limitations
Event signaling (Archjava, CCM, ...)
Subscribers management (Javabeans, ...)
Subscriber side limitations
Receivable events (CCM, ...)
Subscriber reaction
Goal
Extract the application dependent code from components
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 24 / 32
25. The Scl Solution Based on Properties
Property
External state of a component (Javabeans)
Automatically notifies its value changes if needed
Only declared by the component programmer
Property Structure:
A name
An access port provides getter and setter services
A notification port to invoke notifying services
Notifying services
Notify Before Change, nbc:value:oldValue:
Notify After Change, nac:value:oldValue:
...
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 25 / 32
26. Example: The chat client component with a ChatText
property
SCLCOM PON E N TBU I LDE R create: # ChatClient
properties: ’ c h a tT e x t nickName ’.
outPorts: ’ Networking ’ inPorts: ’ Chatting ’.
CH ATCL IEN T>>init ” p r e s e n t e d in Figure 3”
CH ATCL IEN T>>primitivechatText
” i n t e r n a l component accessor d e f i n e d by the
programmer and used by the generated c h a t T e x t
p r o p e r t y accessor ”
chatText ifNil: [ chatText := ’ ’ ].
ˆchatText
CH ATCL IEN T>>primitivechatText: newV
chatText := newV
CH ATCL IEN T>>primitivenickName
nickName ifNil: [ nickName := ’ anonymous ’ ].
ˆnickName
nbc:value:oldValue:
chatText:
nac:value:oldValue:
ChatClient
Chatting
ChatText
Networking
chatText
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 26 / 32
27. States changes connections
Standard connections
Based on connectors (ports + glue code)
Source ports are notifying ports of properties
Features
Uniformity
Extensibility
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 27 / 32
29. Implementation of Scl
Advantages of Smalltalk
Prototyping is easier and faster than in statically typed languages
The meta-level enables message interceptions, addition of new entities
(Component, Connector, ...), ...
Block can be used for representing glue code
A step to investigate what could be a dynamic component oriented
language
Difficulty(ies) with Smalltalk
Encapsulation
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 29 / 32
30. Outline
1 Context
2 A Short Overview of Scl
3 The Connection Mechanism
4 AOP Support Using Connectors
5 Publish/Subscribe Support Using Properties
6 Conclusions
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 30 / 32
31. Conclusions
Scl
A component-oriented language
Only one entity of reuse: Component
Component Composition
Connections based on Connectors
AOP support using Connectors
Component Properties
Prototyped in Smalltalk
Current Work
Larger case studies
Investigate dynamicity
Improve the prototype
Tools
Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 31 / 32