notes.txt 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. Notes about the future of SCCD
  2. ==============================
  3. Long-term vision:
  4. - code generation, work in progress:
  5. - Rust as a target. Benefits:
  6. - Very portable:
  7. - compile to WebAssembly (SCCD in browser!)
  8. - Rust compiler can produce C-libraries: call from Python, Java, ...
  9. - Very good performance
  10. - Zero-cost abstractions (optimize generated code for readability)
  11. -> "Have your cake, and eat it too"
  12. - Safety
  13. - improve action language:
  14. - highest priority:
  15. - interfacing with external code only works with Python modules
  16. - less important, deal with it when it becomes a problem:
  17. - statically typed (good), but no generics (bad)
  18. - user cannot define his/her own types
  19. - dynamic creation/destruction of instances (the "CD" part of SCCD)
  20. - graphical editing of statecharts
  21. - most likely in diagrams.net ("drawio")
  22. - convert drawio (XML) models to SCCDXML
  23. - statechart editing plugin
  24. - improve statechart "interface" definition: in/out event, variables (+ observers?), functions, objects
  25. -> YAKINDU as inspiration
  26. - testing framework
  27. - support white-box testing
  28. - more expressive test models (like YAKINDU's SCTUNIT)
  29. Random notes:
  30. - Explore per-state data models
  31. - Right now, there's a single datamodel for the entire statechart. All of the statechart's variables are declared there.
  32. - We could have datamodels per state: Variables declared in state A's enter actions would belong to A, and be readable/writable by any transition (guard, actions) sourcing from A's substates, as well as the enter- and exit actions of A's substates.
  33. - The benefit would be composability: 2 statechart models could be merged without having conflicting variables
  34. - The same non-conflicting merge could also be achieved by automatic renaming, though.
  35. - Another benefit would be savings on memory consumption: The memory consumed by the datamodel of 2 non-orthogonal states would only be the size of the biggest datamodel, instead of the sum of the 2 datamodels.
  36. - Conclusion: Could be interesting for very large, composed, statecharts
  37. - Durations in action language are a single type, consisting of an integer value and a unit. Perhaps it would be better to have a separate duration type for every unit. Especially in Rust it is better to leave the units to the type system, and only work with 'the numbers' in the machine code :)
  38. - Statechart interface:
  39. - want YAKINDU style: strict separation between:
  40. - input events
  41. - internal events
  42. - output events
  43. - each declared with their parameter types
  44. - in/out/internal events grouped per port
  45. - operations? also belong to port, or keep separate?
  46. - CD-part of SCCD:
  47. - look at ROOM! (Real-time Object Oriented Modeling, Bran Selic)
  48. - (DONE) Currently, a basic state is represented in the abstract syntax as an Or-state with no children. Instead, it should be represented as an And-state with no children.
  49. Rationale:
  50. - The (flattened) set of states representable by an Or-state is the *sum* of the sets of states of its children. If an Or-state has no children, mathematically its set of states has 0 elements, as 0 is the neutral element for addition.
  51. - The (flattened) set of states representable by an And-state is the *product* of the sets of states of its children. If an And-state has no children, mathematically its set of states has 1 element, as 1 is the neutral element for multiplication.
  52. - Since a basic state represents exactly 1 state, an empty And-state is the right way to model it.
  53. This change will have a positive impact on the complexity of the Rust code generator.
  54. - (DONE) Better not to model history states as states in the state tree of the abstract syntax. A history state should not occur in the list of children of its "parent". Instead, it is a special property of its parent state, indicating that history is enabled for this state.
  55. - Possible "innovative" performance optimization: immediately after making a transition, based on the new set of current states, already calculate a superset of transition candidates for the next transition.
  56. Rationale: This will speed up the next transition, as fewer transitions have to be evaluated when generating the set of candidates. The total amount of "calculation time" remains the same, we have merely made some calculations sooner, i.e. after firing the previous transition instead of as part of firing the current one. It is more likely that a "the computer" has resources available after firing a transition, as it may take some time before the next event arrives (user input, a timeout, ...).