Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Don't mention JSONPath, HTML DOM Query, one-time rule execution (DOM/email changes are still good example of independence/idempotency problems)

...

  • Eventexes provide a declarative means of specifying the event scenarios to which a rule applies. Developers should plan the eventexes they use in their applications with care.
  • Conditions declare the contextual conditions under which actions should be taken. KRL's expression language provides a very capable means for computing the context.
  • The embedded little languages for regular expressions, JSONPath and HTML DOM Query, are all declarative methods regular expression language is a declarative method for computing results.

Developing a KRL application requires understanding the relevant events, their attributes, and determining the correct reactions to those events. More than one rule, even in a single rule set, might fire in response to a given event and the conditions that surround it. A KRL developer should plan the actions a rule takes so they play nice with each other. This is especially important when you realize that a user might have rule sets from other developers installed that respond to the same event and send directives to the same endpoints.

Because rule sets execute each rule once, rules in order , for any given event, developers can use the instincts they honed working with other statically scoped languages to understand their rule sets and the rules within them.

As you've seen, persistents provide a means of creating data values that are available across rule and rule set executions. Normal KRL expressions do not have the ability to cause side-effects in values. This is slightly more restrictive than what developers are used to from their experience with most programming languages, but limits most effects to just the postlude.

...

As mentioned, event languages like KRL can build applications that exhibit extreme extremely loose coupling. Each rule is clearly identifiable with a specific portion of the experience based on its eventex, condition, and action.

...

Idempotent and independent actions are not always possible. In addition, some domains are more prone to these types of actions that than others. For example, in the domain of Web pages, it's fairly easy to make changes to the DOM in such a way that multiple actions will result in good results and also preserve the DOM structure so that other rules can fire without interference. In the email domain, on the other hand, while deleting an email by message ID is idempotent, forwarding it isn't. Further, deleting an email interferes with a latter action that forwards the same email.