SCL

487 views
436 views

Published on

Scl : a Simple, Uniform and Operational Language for Component-Oriented Programming in Smalltalk. Luc Fabresse,
Christophe Dony, Marianne Huchard.
ESUG 2006, Prague

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
487
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

SCL

  1. 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. 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. 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. 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. 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. 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. 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. 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. 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
  10. 10. Example : a chatclient component Chatting ChatClient Interface Orientation Port Caption: Networking connect: disconnect sendData: receiveData join: leave send: Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 10 / 32
  11. 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. 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. 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. 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
  15. 15. Example: Connection of two Components with Adaptation ChatClient Networking Networking <<SclBinaryConnector>> Code glue Chatting Source ConnectionManager Target connect: disconnect sendData: receiveData closeConnection openConnectionTo: send: receive: Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 15 / 32
  16. 16. Example: Connection of two Components with Adaptation receive sendData: closeConnection openConnectionTo: Target send: disconnect connect: ChatClient Networking Networking <<SclBinaryConnector>> Code glue Chatting Source ConnectionManager receiveData: SclBinaryConnector new source: ( chatClient port: #Networking ) target: ( connectionManager port: #Networking ) glue: [ :source :target :message | (message selector = #connect:) ifTrue: [ ^ target openConnectionTo: (message arguments) ] ... "some more stuff" ] ; connect. Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 16 / 32
  17. 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
  18. 18. Mixing AOP and Component Appoaches Why? Encapsulate the scaterred code of specific concerns (Log, Transaction,...) How? Asymmetric approaches Symmetric approaches Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 18 / 32
  19. 19. Limited AOP support in Scl Joint Points on Ports before/after/around service invocation before/after/around connection/disconnection Special Connectors Source ports are coupled with a keyword (beforeServiceInvocation, ...) Weaving Regular connection/disconnection mechanism Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 19 / 32
  20. 20. Example: A Logger component LoggerChatClient Networking Chatting log: <<beforeSI>> Logging glue code <<SclFlowConnector>> SclFlowBinaryConnector new source: ( (chatClient port: #Chatting) beforeServiceInvocation ) target: ( logger port: #Logging ) glue: [ :source :target :message | target log: (message selector asString) ] ; connect. Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 20 / 32
  21. 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. 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. 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. 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. 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. 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. 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
  28. 28. Example: The whole chat client application P P ChatClient Networking Chatting ChatText NickName ChatClientGui Networking NetworkManager <<SclBinaryNacConnector>> Displaying Sending <<SclBinaryNacConnector>> SclBinaryNacConnector new source: ( chatClient notifyPortOf: #ChatText ) target: ( chatClientGui port: #Displaying ) glue: [ :source :gui :anInvocation | gui displayText: anInvocation arguments second ] ; connect. Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 28 / 32
  29. 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. 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. 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
  32. 32. Thanks... Questions? Suggestions? Comments? Fabresse, Dony, Huchard (Lirmm/UM2) Component-Oriented Programming ESUG 2006 32 / 32

×