Question

What is the name of the following programming paradigm:

Code is executed based on a set of logical tests resolving to true (the clause). The clause is comprised of operators and operands. Each operand is a value/object.

Instead of evaluating the clause explicitly, as is done in imperative languages (e.g., normal flow control like if(){}), the clause is declared and bound to the resulting code. When the clause is satisfied, at any point in the future, the code will execute.

So, it's basically a dependency tree that re-evaluates whether the code should execute whenever a dependency changes state.

E.g.,

when(a && b && c < 3 && d.changes())
{
  runThisCode();
}

I'm looking for a more formal name and definition, and I haven't come up with anything after searching for it. It's somewhere between declarative and imperative, but I've never seen a language or paradigm that lets one do this.

Thanks, Sean

Was it helpful?

Solution

OTHER TIPS

Sounds like a Rule engine to me. E.g. in Jess you can define such declarative rules and call into imperative or object-oriented Java code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top