liveBook · Manning

PreventPersistence strategy

As explained in Building User-Friendly DSLs

A validation strategy that prevents incomplete or invalid DSL content from being saved or processed by downstream generators and build steps.

PreventPersistence blocks the generator and build step when DSL content contains validation issues. It prevents incomplete content from reaching downstream processing, but blocking persistence can stop domain experts from sharing faulty content for diagnosis. section 9.2.1 section 9.4

Apply the strategy with these considerations:

  • Detect missing properties, such as an attribute name or type, before generation proceeds. section 9.2.1
  • Stop the generator and build step from running on ASTs that contain issues. section 9.4
  • Use it as a last measure when possible; preserving faulty ASTs can let domain experts share them with software developers. section 9.4
  • Combine it with ImposeConstraints so users receive explicit issues rather than encountering an unexplained downstream failure. section 9.2.1

Missing attribute name

If an attribute has no name, saving the DSL content can be refused before camelCase receives an undefined value and the generator crashes. A stricter policy instead preserves the faulty AST for developers and prevents only generation and building. section 9.2.1 section 9.4

How Building User-Friendly DSLs covers it

How deep it goes
Defines the blocking policy and its tradeoff, but does not specify validation or persistence implementation details.
Examples
Uses missing attribute names or types that can cause camelCase to receive a non-string value.
What it assumes
Assumes familiarity with DSL content, ASTs, generators, build steps, and domain-expert issue reporting.
What you can do after
Operate a DSL pipeline that refuses or blocks faulty content before generation and building, while weighing diagnostic sharing.
How it connects
Connects validation constraints with ASTs, generators, build steps, ImposeConstraints, and HandleFaultyContent.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building User-Friendly DSLs. The section links point to the parts of the book it draws on.