Action Script or JavaScript: A Comparison
Recommendations
Use Action Script if you just have started to develop within the Designer.
With Action Script you have full debugging (tracing) support with the Analyzer.
Since only Action Script is supported for conditions in activity diagrams, all developers must at least familiarize themselves with the basics of Action Script.
Use JavaScript
if you have difficulties solving something in Action Script.
if you are an experienced JavaScript developer.
Introduction to Action Script
In the Designer, you can use Action Script for programming in the backend. Action Script is not a complete programming language: It does not include control statements like if, or loops. Action Script works well in combination with activity diagrams where you have conditions and loops.
A lot of existing models of libraries, as well as generated code from the Compiler (mapping diagram, execution diagram, base operations) use Action Script. If you trace a service in the Analyzer, you will also be able to analyze this code.
Refer to Using Action Script in the Designer Guide for details.
For more information about tracing with the Anlayzer, refer to Using the Analyzer with Designer Services.
Introduction to JavaScript
The xUML Runtime uses an embedded V8 JavaScript engine, so you can use modern JavaScript code.
The engine does not support the window object from browsers or any Node.js functionality.
Refer to Using JavaScript in the Designer Guide for details.
TypeScript is not supported by the Designer.
Comparison: Action Script vs. JavaScript in the Designer
Area | Function | Action Script | JavaScript |
---|---|---|---|
Tooling | Debugger | Use the Analyzer to trace Action Script | no support |
Editor | Text editor with highlighting of key words | Code completion for standard JavaScript types and functions | |
Validation | Syntax check is at compile time (= during validation) | Syntax check is at runtime and not at compile time | |
Activity Diagram | Condition | Boolean Action Script expression | no support |
Get Transformation | Action Script function expression | no support | |
Integration | Call other operations | You can call any other Designer operation | You can call any other Designer operation (since PAS 24.2) |
Adapter | You can not call any base operation which needs a stereotype (adapter) | ||
Control statements | While loop | no support | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while |
Loop an array | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of | ||
if statement | No support | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else | |
Condition operator | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator |