liveBook · Manning

Increment effect

As explained in Building User-Friendly DSLs

A DSL concept representing an operation that increases the value of an attribute by a numeric operand of the same type.

An increment effect is a business-rule consequence that increases an affected attribute by a numeric operand. Its operand must be numeric, and the referenced attribute must have the same type. The attribute reference remains an explicit child AST object, allowing the effect to reuse Attribute Reference projection logic. section 14.1.3

Implement an increment effect by:

  • Representing the consequence with an Increment Effect AST object containing a value and an Attribute Reference. section 14.1.3

Applying a rental discount

A rule triggered by a Saturday rental period can translate to an if statement that adds 10 to the local discount value. A second rule can add 5 when the rental starts in December; discount therefore aggregates multiple increment effects.

How Building User-Friendly DSLs covers it

How deep it goes
Explains AST representation, projection, type constraints, and JavaScript translation while deferring broader effect-model intricacies.
Examples
Uses rental discounts, Saturday and December conditions, discount += 10, and discount += 5 as implementation examples.
What it assumes
Assumes business rules, AST objects, attribute references, projections, and runtime translation, while making operand-type matching explicit.
What you can do after
Builds and validates an Increment Effect AST projection, then translates it into conditional JavaScript updates.
How it connects
Connects Increment Effect to business rules, Attribute Reference, AST objects, type checking, and execution order.

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.