concept Java implementation in category dsl

appears as: Java implementation, The Java implementation
DSLs in Action

This is an excerpt from Manning's book DSLs in Action.

But even though we’ve used the right vocabulary, the DSL is also Java, so it has to abide by the syntax restrictions and verbosity that Java requires as a programming language. The call to valueAs takes as input an implementation artifact that you have to specify nonlocally to the current context. Java doesn’t support higher-order functions out of the box, so we can’t specify a pretty inline valuation strategy. For the Java implementation, the user of the DSL can define only concrete implementations for each of the order valuation strategies. In the DSL implementation, we define the contract for order valuation as an interface:

Table 4.1. Possible improvement areas for decorators in the Java DSL

Can we improve?

How?

Expressivity and domain friendliness. Be less verbose, but the sky’s the limit here.
Hardwired relationship between Trade and the decorators. Get rid of static inheritance relationships, which will make the decorators more reusable.
Readability. The Java implementation reads outside in, from the decorators to the core Trade abstraction, which isn’t intuitive. Put Trade first, and then the decorators.