Rules templates or functions for reusability

Two things:

  1. There are a number of example apps in our public GitHub repo. They all do something real and useful. They also show some of the basics of creating an app, and are possible starting points to be modified into something different. The way I learned to create apps was just that, I took from others and modified what they had done.

  2. For quite a few years now I thought that the creator of webCoRE missed an opportunity when he created it. It's a very good tool with a great UI for creating automations. It takes that UI and spits out a coded representation of the automation, and that coded representation is later run as the Piston. Both of those steps are non-trivial. What I thought he missed was that instead of putting out a coded representation of the automation, he could have spit out Groovy code, an app that implemented the automation directly. Had he done that, the second step would have been avoided completely, and resulting app would have been super efficient.

I know enough computer science to know the challenge what I just wrote represents. It would be a difficult, although achievable project. The result would be very close to what you are describing. I keep tossing this idea out in public in hopes that someone would take it on.

Ironically, Rule Machine actually does something like this. It has snippets of code that run depending upon the definition of the rule. Each action runs such a snippet. So in theory, a variation of Rule Machine could be created that writes those snippets of code out to create an app with equivalent functionality. Unfortunately, Rule Machine has grown to be so feature rich that this doesn't make much sense as a practical matter, and the resulting code wouldn't be the sort that makes a decent template. There is too much complexity.

3 Likes