4

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

sarnold
  • 102,305
  • 22
  • 181
  • 238
Hanoixan
  • 449
  • 3
  • 12
  • Are you thinking of [aspect-oriented programming](http://en.wikipedia.org/wiki/Aspect-oriented_programming)? – sarnold Mar 28 '11 at 07:37

2 Answers2

2

Maybe it is dataflow programming? Or reactive programming?

Marat Salikhov
  • 6,367
  • 4
  • 32
  • 35
  • Based on the Wikipedia article for Reactive Programming, I feel like what I'm asking about follows it the most closely. Nothing is being inferred from a knowledge base. It's much simpler than that, much like the given example of cells that automatically update in Excel when referenced cells in a formula change. – Hanoixan Mar 29 '11 at 00:10
2

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.

hfs
  • 2,433
  • 24
  • 37
  • I think you're right, I'd call it "rule based programming" and the system I've played with, looong time ago,is [CLIPS](http://en.wikipedia.org/wiki/CLIPS), which apparently is an ancestor to Jess. Perhaps one can do similar stuff in [Prolog](http://en.wikipedia.org/wiki/Prolog), I've never fully explored that. – bart Mar 28 '11 at 10:53