clic
play

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 -


  1. 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. 2 Software Engineering Virtuous Circle Programming Language N. Bouraqadi & L. Fabresse - IWST ESUG 2009 Good Practices

  3. 3 Some Good Practices • Document the code – Design drawings N. Bouraqadi & L. Fabresse - IWST ESUG 2009 – Comments • Uncoupling software "parts" – Inversion of control – Use of design patterns such as Observer

  4. 4 Some Issues with OOP • Out of sync documentation and code – Code change not reflected in documentation N. Bouraqadi & L. Fabresse - IWST ESUG 2009 • Implicit dependencies – Dependencies hidden inside methods

  5. 5 Components • A step towards enforcing: – Documentation N. Bouraqadi & L. Fabresse - IWST ESUG 2009 – Loose Coupling

  6. 6 Programming with components 1. Describe the architecture – Part of the software N. Bouraqadi & L. Fabresse - IWST ESUG 2009 2. Get the appropriate components – Implemented or picked out of some library 3. Assemble the components – According to the architecture

  7. 7 A Component is… a piece of software – Standalone or not N. Bouraqadi & L. Fabresse - IWST ESUG 2009 self-documented – Requirements / Dependencies – Provided services – Parameters – Architecture easy to deploy – Explicit connections to the rest of the software

  8. 8 Introducing Components into a Programming Language • "Objects-based" components – Objects = building blocks for components N. Bouraqadi & L. Fabresse - IWST ESUG 2009 • Reification of component related concepts • Ex: FracTalk, MalevaST

  9. 9 Introducing Components into a Programming Language • Pure component-based programming language N. Bouraqadi & L. Fabresse - IWST ESUG 2009 – No objects – Ex: SCL

  10. N. Bouraqadi & L. Fabresse - IWST ESUG 2009 components Pure Object-based Evaluation   P e r f o r m   a R n e c u e s e O O c    o d E e a s y t o  i U m n p i f l e y m d e e s n i t g n a n d c o d e 10

  11. N. Bouraqadi & L. Fabresse - IWST ESUG 2009 CLIC  Proposal P e r f o r  m a R n e c u e s e O O c  o d e E a s y t o i U m n p i f l y e m d e e s n i t g n a n d c o d e 11

  12. 12 Object-Components Symbiosis • CLIC Components ARE objects – Can be used by objects N. Bouraqadi & L. Fabresse - IWST ESUG 2009 • Smalltalk objects ARE "dirty" components – Can be connected to components – Possibly with implicit / tight dependencies • Same run-time (VM, image) – Same performances

  13. 13 CLIC Component Simple N. Bouraqadi & L. Fabresse - IWST ESUG 2009 Required … Ports C3 Single C1 + Provided C4 Port C2 + C5 Collection + + Attributes Required … Assembly Ports +

  14. 14 Attributes • Private or shared N. Bouraqadi & L. Fabresse - IWST ESUG 2009 • Handled through accessors only • Observables – 1 attribute => 1 collection required port

  15. 15 Counter in CLIC N. Bouraqadi & L. Fabresse - IWST ESUG 2009 12 count + countObservers count: anInt port count increment attribute decrement

  16. 16 Counter in CLIC CLComponent subclass: #Counter localPrivateAttributeNames: #(count) N. Bouraqadi & L. Fabresse - IWST ESUG 2009 privateAttributesInitDict: { #count -> 0} sharedAttributeNames: #() sharedAttributesInitDict: {} localRequiredPortsDict: {} category: #'ClicExamples-Clock'

  17. 17 Counter in CLIC CLComponent subclass: #Counter localPrivateAttributeNames: #(count) N. Bouraqadi & L. Fabresse - IWST ESUG 2009 privateAttributesInitDict: { #count -> 0} sharedAttributeNames: #() sharedAttributesInitDict: {} localRequiredPortsDict: {} category: #'ClicExamples-Clock'

  18. 18 Counter in CLIC CLComponent subclass: #Counter localPrivateAttributeNames: #(count) N. Bouraqadi & L. Fabresse - IWST ESUG 2009 privateAttributesInitDict: { #count -> 0} sharedAttributeNames: #() sharedAttributesInitDict: {} localRequiredPortsDict: {} category: #'ClicExamples-Clock'

  19. 19 Counter in CLIC CLComponent subclass: #Counter localPrivateAttributeNames: #(count) N. Bouraqadi & L. Fabresse - IWST ESUG 2009 privateAttributesInitDict: { #count -> 0} sharedAttributeNames: #() sharedAttributesInitDict: {} localRequiredPortsDict: {} category: #'ClicExamples-Clock'

  20. 20 Counter in CLIC Counter >> increment self count: self count + 1 N. Bouraqadi & L. Fabresse - IWST ESUG 2009 Counter >> decrement self count: self count - 1

  21. 21 Counter in CLIC |myCounter| myCounter := Counter new. N. Bouraqadi & L. Fabresse - IWST ESUG 2009 myCounter increment. Transcript cr; show: myCounter count

  22. 22 StopWatch in CLIC N. Bouraqadi & L. Fabresse - IWST ESUG 2009 counter reset + start + stop seconds ticker

  23. 23 Direct message handling method lookup & evaluation N. Bouraqadi & L. Fabresse - IWST ESUG 2009 count: 0 counter reset receiveEvent: + + ticker

  24. 24 Message forwarding N. Bouraqadi & L. Fabresse - IWST ESUG 2009 counter receiveEvent: start + increment + start ticker

  25. 25 Message translation N. Bouraqadi & L. Fabresse - IWST ESUG 2009 count seconds counter + + ticker

  26. 26 StopWatch in CLIC CLComponent subclass: #StopWatch localPrivateAttributeNames: #(counter ticker) N. Bouraqadi & L. Fabresse - IWST ESUG 2009 privateAttributesInitDict: { #counter -> Counter @ #new. #ticker -> GenericTicker @ #new } …

  27. 27 StopWatch in CLIC … sharedAttributeNames: #(Scheduler) N. Bouraqadi & L. Fabresse - IWST ESUG 2009 sharedAttributesInitDict: { #Scheduler -> Processor} …

  28. 28 StopWatch in CLIC … architectureFrom: { N. Bouraqadi & L. Fabresse - IWST ESUG 2009 (#ticker @ #notifiedComponents) => #counter }; …

  29. 29 StopWatch in CLIC … operationsExportDictFrom: { N. Bouraqadi & L. Fabresse - IWST ESUG 2009 #counter @ #(count) -> #(seconds). #ticker @ #(start stop)}; …

  30. 30 StopWatch in CLIC … exportedRequiredPortsDictFrom: { N. Bouraqadi & L. Fabresse - IWST ESUG 2009 #counter @ #(countObservers) -> #(secondsObservers)}

  31. 31 StopWatch in CLIC StopWatch>>reset self counter count: 0 N. Bouraqadi & L. Fabresse - IWST ESUG 2009 StopWatch>>initialize super initialize. self ticker tickSelector: #increment; stepDelayDuration: 1000; processPriority: self Scheduler timingPriority.

  32. 32 Conclusion • Components enforce some programming good practices N. Bouraqadi & L. Fabresse - IWST ESUG 2009 – Documentation • Architecture • Requirements / Dependencies • Provided services • Parameters – Loose coupling • Explicit dependencies

  33. 33 Conclusion • Smalltalk enables object-component symbiosis N. Bouraqadi & L. Fabresse - IWST ESUG 2009 – Easy implementation • Reflection • No language change – Components as first class entities – Same run-time => Same performance – Ability to use objects ("dirty" components)

  34. 34 Future Works • Version management N. Bouraqadi & L. Fabresse - IWST ESUG 2009 • Import / Export support • Large scale experiments

  35. CLIC! + CLIC a Component Model Symbiotic with Smalltalk N. Bouraqadi and L. Fabresse Ecole des Mines de Douai http://vst.ensm-douai.fr/Clic

Recommend


More recommend