Developing MADS modules in VS Code

The MADS V5 extension for Visual Studio Code is the recommended environment for working with MADS. It does not replace the mads tool: it runs it for you, so everything you do in the editor can be repeated in a terminal or on a continuous integration server.

The Mads view

When you open a folder containing MADS modules, the Mads view appears in the Explorer. For each module it shows:

Section Contents Common actions
Customization The XML metadata files Edit domains, data model, texts and parameters
Runtimes The run configurations Add a runtime, choose the default one, run and debug
Dependencies The modules it depends on Edit the module dependencies
Deployment The deployment descriptor Publish the module or app to WAPP

The view's toolbar lets you add a new module (Add a new mads module) or refresh it.

Editors and inspectors

  • Metadata editors: Edit domains, Edit data model, Edit strings, Edit parameters, Edit default runtime, Edit module dependencies and Edit POM descriptor.
  • Mads: Domains inspector and Mads: Metadata model inspector: browse the module's domains and database model.
  • Mads: Metadata model generator: generates the database schema from an existing database.
  • Mads: Database syncronizer: compares and synchronises the model with a database.
  • Mads: Resources translator: translates the module texts.
  • Mads: Security utility: manages the module security.
  1. Start with the model. Define domains and tables before screens. A good domain (an amount or a status code, for example) is reused by many columns and keeps them consistent.
  2. Generate after every metadata change. Mads: Generate module updates entities, Peers, Filters and texts. For a single kind of resource there are Generate java model, Generate flutter/dart model and Generate text resources.
  3. Let the compiler guide you. After regenerating, compile errors point exactly at the code affected by the change. Fix them before moving on.
  4. Never write column names as strings. Always use the generated enum (FacturaField.estado), including in table renderers and editors.
  5. Test locally. Mads: Run & Debug app launches the module with its default runtime; Mads: Run module tests runs its tests.
  6. Build and version. Mads: Build module compiles, packages and installs into your local Maven repository. Before a release, Mads: Update module version sets the new version.
  7. Deploy and publish. Mads: Deploy module publishes the artifact to the Maven repository; Mads: Publish module and Mads: Publish app publish it to WAPP.

Working as a team

  • Version the metadata (src/main/res) just like code: it is the module's source of truth.
  • Review metadata changes together with the regenerated code in the same pull request.
  • Keep translations up to date with Mads: Resources translator before every release.

Next step: automate the cycle with Maven.