ARail EBL

Software architecture

How ARail-EBL is built

The framework in the browser (web/arail), the app on top of it (web/app) and the Python tools, in UML: the packages, the data flow, and for every model its classes and what it does, step by step. Open a model to see its diagrams.

This page is drawn from one file, web/architecture/model.js, and a test checks that file against the code (how).

Packages and modules

Drawing the diagram…

Data flow

Drawing the diagram…

Models

Each model: what it does, its classes (class diagram), its behaviour (activity diagrams, also as steps in text), its settings, the events it sends and listens to, its rules and constants, and its source files. The code that does an action is written under it.

Events

The parts of the world talk over its event bus (world.events): who sends what. A plugin can listen to all of them.

Extension points

Everything a layout file names by its type comes from the registry (web/arail/core/registry.js): object types, simulations, disruptions and vehicles. Plugins add their own (see Extending ARail).

Notation

Keeping it true

The diagrams are only useful while they match the code. So the page is data, and the data is tested: tests/js/architecture.test.js (part of npm test) fails when

  • a source file of web/arail, web/app, web/plugins, web/markers or tools/arail_tools belongs to no package here, or a file named here does not exist;
  • a class, attribute or operation named here is not in its file, or an action of an activity names code that is not there;
  • an event is sent somewhere in the framework and not listed under Events, or one listed here is sent nowhere;
  • an object type, simulation, disruption or vehicle is registered and not listed under Extension points (or the other way round), or a simulation's settings differ from its parameters here;
  • an activity has a step that cannot be reached, a step that leads nowhere, or a decision without guards.

Whoever changes the code changes web/architecture/model.js in the same commit (see CONTRIBUTING.md). The prose of docs/architecture.md is cross-checked by hand at the same time.