Would a MoquiScript (aka Groovy based Moqui DSL) add value to the framework?

Hi all.

Would a ‘MoquiScript’ add value to the Moqui framework?

I use XmlActions and I’m getting better at it everyday. I like the fact that it hides away some level of complexity. I love that it is declarative and that XML schemas allow a level of code validation in my preferred IDE (VS Code for the moment). I also like the fact that an Analyst can make sense of it.
However I keep having the hunch that potentially having a Groovy DSL based ‘MoquiScript’ could be a good thing. The ‘MoquiScript’ would be doing pretty much what XmlActions are doing but in a more ‘coded’ fashion, a bit less verbose and with probable other features I can’t clearly foresee at this stage (i.e. increased debug-ability …).

Would you be so kind to give your opinion ?
If you feel it’s a silly idea do not hesitate to let me know :slight_smile:

Rgds.

For the most part the Moqui Framework API is designed as a ‘fluent’ API to facilitate method chaining. The idea behind this is you can write code more efficiently and concisely than non-fluent APIs. There is one exception to this that could use some work and that is the entity find conditions. For some early work on that concept see the entity-cond-fluent branch of the moqui-framework repo.

If an API is designed well enough then a DSL (domain specific language), in my opinion, does not add significant value, or in other words reduce code size, complexity, maintainability, etc in a significant way. Another advantage of a fluent API is that it works in Java, Scala, Rhino/etc JavaScript, and so on in addition to working in Groovy.

On the other hand, I haven’t put any significant time into trying out different DSL designs (inspired by XML Actions elements and otherwise) to say that with a lot of confidence. It could be that this is well worth it.

1 Like