1 / 15

StateMachine representations (file formats)

StateMachine representations (file formats). Maciej Czechowski. Introduction. Harel StateCharts have become a convenient way for describing applications and services. Currently there are a few major file formats designed for storing StateMachine information. UML – graphical solution.

monifa
Download Presentation

StateMachine representations (file formats)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. StateMachine representations(file formats) Maciej Czechowski

  2. Introduction Harel StateCharts have become a convenient way for describing applications and services. Currently there are a few major file formats designed for storing StateMachine information.

  3. UML – graphical solution UML has support for Harel-like statemachines with some Object-Oriented additions. This allows easy design, using one of many UML-tools available. • easy graphical design • statemachines are only part of UML, they have to be part of classes or collaborations and use their datamodel • different tools may use different file formats

  4. XMI –XML metadata interchange • interchange format for UML – allows different tools to work together • text format, based on XML • saves all UML features – results are very large • no direct, clearly specified way for describing statemachine variables (they may to be described in other elements, e.g. parent class, if needed), etc. • hardly human-readable, designed for machine analysis

  5. SCXML – StateChart XML • XML based language developed by W3C (current status: working draft) • general-purpose event-based state machine language based on Harel statecharts • has well-defined datamodel • human readable • execution environment based on webservices exists (Apache SCXML)

  6. XMI vs SCXML • XMI comes from UML-diagram,is larger and less readable • Most of UML design tools can produce XMI files, providing comfortable way to design statemachines; SCXML is still working draft with few tools available • SCXML files are smaller andcleaner as they represent only StateMachines with their datamodel, while XMI saves all UML metadata • Conversion between these formats should be possible, although it would not be 1:1 (e.g. SCXML does not support Choice states)

  7. Other formats • ebXML – language designed for business process specification; its statemachine language semantics are closely connected to e-commerce and therefore not applicable for general applications • XTND – notation for simple finite state machines; lacks Harel statecharts additions (parallel states,etc.) • other formats exits, but are rather unpopular and used mostly in proprietary solutions

  8. Runtime representation (1/4) • StateMachines can be used for direct execution by developing Virtual Machine. • VM designed for mobile environment would need compact data files, describing only logic required for correct StateMachine execution – let’s call such file format as runtime representation. • XML-based formats do not meet these requirements!

  9. Runtime representation (2/4) • Both XMI and SCXML save all design information (such as variable names). XMI saves also a lot of UML-specific information. • All expressions and commands (guards, effects) are saved as plain text (opaque expressions) without parsing, type checking, variable matching, etc. • Many parts of design information are not used in runtime!

  10. Runtime representation (3/4) • State and variable names are not needed in runtime, as they have unique identifiers. • We have to maintain Operation (used for triggers) and Effect names, as they come from and are parsed outside. • Effect and Guard expressions can be saved as corresponding Abstract Syntax Trees – syntax and type checking can be made after design; virtual machine can be simpler (no parser)!

  11. Runtime representation (4/4) • XML format uses a lot of space for tags – as runtime representation format is designed for machine analysis we can use more compact binary format. • Simple translator was designed, being able to convert XMI file to binary (maintaining UML StateChart structure).

  12. Simple Example Consider the following simple StateMachine: Attributes: tempInFahrenheit : int temperature : int Operations: tempRead(tempInFahrenheit: out)

  13. AssignCommand for the opaque behaviour temperature=tempInFahrenheit+273 SimpleVariable BinaryExpression reference to temperature AST tree is built… right left Operator VariableExpression IntegerExpression + SimpleVariable 273 reference to tempInFahrenheit and can be byte-saved as 5C5A 00006466745A0001686E0000 01117207 Example - AST

  14. Example - results (size in bytes)

  15. Summary • Design-stage formats like XMI or SCXML provide easy way for describing StateMachines, however they save a lot of additional information not needed in runtime. • By removing unnecessary names, parsing expressions and saving result as byte stream a great size improvement can be achieved. • Binary format is mostly unusable for further editing, but can have great use for virtual machines as it fully maintains statemachine logic.

More Related