# Difference between revisions of "NovaScript Introduction"

Line 2: | Line 2: | ||

flow model, you are already writing NovaScript code when you enter expressions for initial Stock values, | flow model, you are already writing NovaScript code when you enter expressions for initial Stock values, | ||

Flows, and Terms (we’ll refer to these as ''component definitions''). For these models, however, the code | Flows, and Terms (we’ll refer to these as ''component definitions''). For these models, however, the code | ||

− | is generally restricted to simple numerical expressions. You will see that to express the relationships | + | is generally restricted to simple numerical expressions. You will see that to express the relationships required of complex models your definitions will necessarily include a broader set of expressions. |

− | required of complex models your definitions will necessarily include a broader set of expressions. | + | |

− | NovaScript is an extension of a well-known and widely used language called ''JavaScript''. This means that | + | NovaScript is an extension of a well-known and widely used language called ''JavaScript''. This means that NovaScript uses JavaScript syntax for all of its code; moreover, any legal JavaScript program is also a NovaScript program. This includes the code used for initial Stock values, Flows and Terms. Fortunately, there are many good sources for learning to program in JavaScript. Please read the introduction to JavaScript contained [[Javascript Light|here]] before continuing with this section. |

− | NovaScript uses JavaScript syntax for all of its code; moreover, any legal JavaScript program is also a | + | |

− | NovaScript program. This includes the code used for initial Stock values, Flows and Terms. Fortunately, | + | |

− | there are many good sources for learning to program in JavaScript. Please read the introduction to JavaScript contained [[Javascript Light|here]] before continuing with this section. | + | |

− | A complete Nova model is expressed in NovaScript. You create the program for | + | A complete Nova model is expressed in NovaScript. You create the program for this model when you click the '''Capture''' button. Nova is able to construct the scaffold for your model using the structure of the visual elements placed on the canvas. As author you are expected to provide the details connecting the various components through the component expressions. In systems dynamics models component expressions generally operate solely on numerical data; i.e., they are simple arithmetic expressions. |

− | this model when you click the Capture button. Nova is able to construct the scaffold for your model | + | |

− | using the structure of the visual elements placed on the canvas. As author you are expected to provide | + | |

− | the details connecting the various components through the component expressions. In systems dynamics | + | |

− | models component expressions generally operate solely on numerical data; i.e., they are simple arithmetic | + | |

− | expressions. | + | |

− | As you extend your use of Nova into more complex applications the coding used to link components will | + | As you extend your use of Nova into more complex applications the coding used to link components will also become more complex. This complexity manifests along the following dimensions: |

− | also become more complex. This complexity manifests along the following dimensions: | + | |

− | *The data structures used. Simple applications can rely on simple numerical data. For more | + | *'''The data structures used'''. Simple applications can rely on simple numerical data. For more advanced use you will need to introduce arrays and objects, and may also want to create your own functions. |

− | advanced use you will need to introduce arrays and objects, and may also want to create your own | + | *'''The program structures required'''. Multi-line computations involving loops and conditionals generally accompany the use of data structures such as arrays and objects. |

− | functions. | + | *'''The use of primitive operators'''. Models using Nova’s aggregating components rely heavily on primops. You will need to become familiar with these primops and how they provide necessary information to the constituents of the aggregators. |

− | *The program structures required. Multi-line computations involving loops and conditionals | + | |

− | generally accompany the use of data structures such as arrays and objects. | + | == What is ''NovaScript''? |

− | *The use of primitive operators. Models using Nova’s aggregating components rely heavily on | + | |

− | primops. You will need to become familiar with these primops and how they provide necessary | + | |

− | information to the constituents of the aggregators. | + |

## Revision as of 22:13, 3 January 2015

All running Nova simulations are expressed in a language called *NovaScript*. Even in the simplest stock-
flow model, you are already writing NovaScript code when you enter expressions for initial Stock values,
Flows, and Terms (we’ll refer to these as *component definitions*). For these models, however, the code
is generally restricted to simple numerical expressions. You will see that to express the relationships required of complex models your definitions will necessarily include a broader set of expressions.

NovaScript is an extension of a well-known and widely used language called *JavaScript*. This means that NovaScript uses JavaScript syntax for all of its code; moreover, any legal JavaScript program is also a NovaScript program. This includes the code used for initial Stock values, Flows and Terms. Fortunately, there are many good sources for learning to program in JavaScript. Please read the introduction to JavaScript contained here before continuing with this section.

A complete Nova model is expressed in NovaScript. You create the program for this model when you click the **Capture** button. Nova is able to construct the scaffold for your model using the structure of the visual elements placed on the canvas. As author you are expected to provide the details connecting the various components through the component expressions. In systems dynamics models component expressions generally operate solely on numerical data; i.e., they are simple arithmetic expressions.

As you extend your use of Nova into more complex applications the coding used to link components will also become more complex. This complexity manifests along the following dimensions:

**The data structures used**. Simple applications can rely on simple numerical data. For more advanced use you will need to introduce arrays and objects, and may also want to create your own functions.**The program structures required**. Multi-line computations involving loops and conditionals generally accompany the use of data structures such as arrays and objects.**The use of primitive operators**. Models using Nova’s aggregating components rely heavily on primops. You will need to become familiar with these primops and how they provide necessary information to the constituents of the aggregators.

== What is *NovaScript*?