CLIC a Component Model Symbiotic with Smalltalk N. Bouraqadi and - - PowerPoint PPT Presentation

clic
SMART_READER_LITE
LIVE PREVIEW

CLIC a Component Model Symbiotic with Smalltalk N. Bouraqadi and - - PowerPoint PPT Presentation

CLIC! + CLIC a Component Model Symbiotic with Smalltalk N. Bouraqadi and L. Fabresse Ecole des Mines de Douai http://vst.ensm-douai.fr/Clic 2 Software Engineering Virtuous Circle Programming Language N. Bouraqadi & L. Fabresse -


slide-1
SLIDE 1

CLIC

a Component Model Symbiotic with Smalltalk

  • N. Bouraqadi and L. Fabresse

Ecole des Mines de Douai http://vst.ensm-douai.fr/Clic

+ CLIC!

slide-2
SLIDE 2
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

2

Software Engineering Virtuous Circle

Programming Language Good Practices

slide-3
SLIDE 3
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

3

Some Good Practices

  • Document the code

– Design drawings – Comments

  • Uncoupling software "parts"

– Inversion of control – Use of design patterns such as Observer

slide-4
SLIDE 4
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

4

Some Issues with OOP

  • Out of sync documentation and code

– Code change not reflected in documentation

  • Implicit dependencies

– Dependencies hidden inside methods

slide-5
SLIDE 5
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

5

Components

  • A step towards enforcing:

– Documentation – Loose Coupling

slide-6
SLIDE 6
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

6

Programming with components

  • 1. Describe the architecture

– Part of the software

  • 2. Get the appropriate components

– Implemented or picked out of some library

  • 3. Assemble the components

– According to the architecture

slide-7
SLIDE 7
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

7

A Component is…

a piece of software

– Standalone or not

self-documented

– Requirements / Dependencies – Provided services – Parameters – Architecture

easy to deploy

– Explicit connections to the rest of the software

slide-8
SLIDE 8
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

8

Introducing Components into a Programming Language

  • "Objects-based" components

– Objects = building blocks for components

  • Reification of component related concepts
  • Ex: FracTalk, MalevaST
slide-9
SLIDE 9
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

9

Introducing Components into a Programming Language

  • Pure component-based programming

language

– No objects – Ex: SCL

slide-10
SLIDE 10
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

10

Evaluation

U n i f y d e s i g n a n d c

  • d

e P e r f

  • r

m a n c e R e u s e O O c

  • d

e E a s y t

  • i

m p l e m e n t Object-based Pure components

       

slide-11
SLIDE 11
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

11

Proposal

U n i f y d e s i g n a n d c

  • d

e P e r f

  • r

m a n c e R e u s e O O c

  • d

e E a s y t

  • i

m p l e m e n t

  

CLIC

slide-12
SLIDE 12
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

12

Object-Components Symbiosis

  • CLIC Components ARE objects

– Can be used by objects

  • Smalltalk objects ARE "dirty" components

– Can be connected to components – Possibly with implicit / tight dependencies

  • Same run-time (VM, image)

– Same performances

slide-13
SLIDE 13
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

13

Single Provided Port

CLIC Component

… + + + …

C3 C4 C5

+

C1 C2

Simple Required Ports Collection Required Ports

+

Attributes Assembly

slide-14
SLIDE 14
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

14

Attributes

  • Private or shared
  • Handled through accessors only
  • Observables

– 1 attribute => 1 collection required port

slide-15
SLIDE 15
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

15

count count: anInt increment decrement

Counter in CLIC

+ 12 countObservers port count attribute

slide-16
SLIDE 16
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

16

Counter in CLIC

CLComponent subclass: #Counter localPrivateAttributeNames: #(count) privateAttributesInitDict: { #count -> 0} sharedAttributeNames: #() sharedAttributesInitDict: {} localRequiredPortsDict: {} category: #'ClicExamples-Clock'

slide-17
SLIDE 17
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

17

Counter in CLIC

CLComponent subclass: #Counter localPrivateAttributeNames: #(count) privateAttributesInitDict: { #count -> 0} sharedAttributeNames: #() sharedAttributesInitDict: {} localRequiredPortsDict: {} category: #'ClicExamples-Clock'

slide-18
SLIDE 18
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

18

Counter in CLIC

CLComponent subclass: #Counter localPrivateAttributeNames: #(count) privateAttributesInitDict: { #count -> 0} sharedAttributeNames: #() sharedAttributesInitDict: {} localRequiredPortsDict: {} category: #'ClicExamples-Clock'

slide-19
SLIDE 19
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

19

Counter in CLIC

CLComponent subclass: #Counter localPrivateAttributeNames: #(count) privateAttributesInitDict: { #count -> 0} sharedAttributeNames: #() sharedAttributesInitDict: {} localRequiredPortsDict: {} category: #'ClicExamples-Clock'

slide-20
SLIDE 20
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

20

Counter in CLIC

Counter >> increment self count: self count + 1 Counter >> decrement self count: self count - 1

slide-21
SLIDE 21
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

21

Counter in CLIC

|myCounter| myCounter := Counter new. myCounter increment. Transcript cr; show: myCounter count

slide-22
SLIDE 22
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

22

StopWatch in CLIC

+

+

counter ticker reset start stop seconds

slide-23
SLIDE 23
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

23

Direct message handling

+

+

counter ticker count: 0 reset receiveEvent: method lookup & evaluation

slide-24
SLIDE 24
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

24

Message forwarding

+

+

counter ticker increment start receiveEvent: start

slide-25
SLIDE 25
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

25

Message translation

+

+

counter ticker seconds count

slide-26
SLIDE 26
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

26

StopWatch in CLIC

CLComponent subclass: #StopWatch localPrivateAttributeNames: #(counter ticker) privateAttributesInitDict: { #counter -> Counter @ #new. #ticker -> GenericTicker @ #new} …

slide-27
SLIDE 27
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

27

StopWatch in CLIC

… sharedAttributeNames: #(Scheduler) sharedAttributesInitDict: { #Scheduler -> Processor} …

slide-28
SLIDE 28
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

28

StopWatch in CLIC

… architectureFrom: { (#ticker @ #notifiedComponents) => #counter}; …

slide-29
SLIDE 29
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

29

StopWatch in CLIC

  • perationsExportDictFrom: {

#counter @ #(count) -> #(seconds). #ticker @ #(start stop)}; …

slide-30
SLIDE 30
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

30

StopWatch in CLIC

… exportedRequiredPortsDictFrom: { #counter @ #(countObservers)

  • > #(secondsObservers)}
slide-31
SLIDE 31
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

31

StopWatch in CLIC

StopWatch>>reset self counter count: 0 StopWatch>>initialize super initialize. self ticker tickSelector: #increment; stepDelayDuration: 1000; processPriority: self Scheduler timingPriority.

slide-32
SLIDE 32
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

32

Conclusion

  • Components enforce some programming

good practices

– Documentation

  • Architecture
  • Requirements / Dependencies
  • Provided services
  • Parameters

– Loose coupling

  • Explicit dependencies
slide-33
SLIDE 33
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

33

Conclusion

  • Smalltalk enables object-component

symbiosis

– Easy implementation

  • Reflection
  • No language change

– Components as first class entities – Same run-time => Same performance – Ability to use objects ("dirty" components)

slide-34
SLIDE 34
  • N. Bouraqadi & L. Fabresse - IWST ESUG 2009

34

Future Works

  • Version management
  • Import / Export support
  • Large scale experiments
slide-35
SLIDE 35

CLIC

a Component Model Symbiotic with Smalltalk

  • N. Bouraqadi and L. Fabresse

Ecole des Mines de Douai http://vst.ensm-douai.fr/Clic

+ CLIC!