Do Code Generators for Decision Modeling Actually Work?

James Taylor wrote: “Frankly I have seen so many failed code generators at this point that I no longer believe that a business-friendly model can be enriched to the point of execution without either making gross assumptions about the deployment OR making the model too different from the original business intent. I prefer to keep the model clean and focused on the business problem and then link to the implementation.” What is your experience with code generators for decision model execution?

This entry was posted in Decision Models. Bookmark the permalink.

4 Responses to Do Code Generators for Decision Modeling Actually Work?

  1. jacobfeldman says:

    +1 Even worse: the errors and explanations are reported in terms of the target system (generated code) and not in original business terms – the reason CASE systems failed long time ago and even the very term is forgotten today.

  2. Code Generators only translate decision models in a language which cannot be read nor understood anymore by most of the business stakeholders, i.e. a blackbox. And reverting blackboxes back into something manageable by the business is exactly one of the main purposes of decision modeling. So, let’s not make the same mistake again.

  3. Well – I am not sure if it is that black and white.
    Jacob – correct me if I am wrong but OpenRules provides a hook from Decision Models via Decision Tables to automation of decision logic. Is that not code generation out of a model?

    And many others are out there do exactly the same using DMN as a starting point to generate automated decisions.

    I am not sure if that is a good idea to do so but I think – James – it is to late!
    Humans are lazy and they like automation of dull repeatable tasks. Why would we not generate repeatable decisions and expose them as a consumable services?

    • jacobfeldman says:

      Hi Olaf,
      I need to correct you – OpenRules does NOT generate code “out of a model”. OpenRules directly executes all decision tables and other decision modeling constructs presented in Excel by instantiating the predefined Java classes in run-time. Our customers may even define snippets of Java inside Excel cells (which look very similar to DMN FEEL) and they will be executed when they run an instance of OpenRulesEngine without any code generation. OpenRules-based decision models are always executable by design. As Bruce Silver pointed in his recent book, “whatever execution algorithm is employed, the DRD (and I’d add, the entire the decision model) should be executable”.

      When OpenRules is used together with DecisionsFirst Modeler, then James’ high-level decision model is simply linked to executable implementations using decision tables represented in OpenRules or other vendor’s format. Again no code generation occurs here.

      Actually, the real problem is not with code generation, but rather with which decision model representation will be maintained: the original one in DMN or the generated one in a target format. I suspect that in many code generation cases, “the target representation” is the one that is actually being supported by users using the target BRMS. And this is the problem! However, if the code is generated on the fly every time when you run the decision model and there is no performance overhead, then it is not a problem.

      As an example, I may point to success of the JSR-331 standard (http://jsr331.org). The same decision model (in this case a constraint satisfaction problem) can be executed by different constraint or linear solvers without changing a single character in the original model. For example, we may generate the proper code for a linear model in the MPS format on the fly (!), then execute this code with one of 7 linear solvers, and then present the results back in the original terms. Nobody ever looks at the generated code and everything works just fine.
      Jacob

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s