Wednesday, April 6, 2005

Dependencies vs. Constraints

[This topic came up yesterday at Chris Roe's seminar on dependency. It was particularly well discussed, so I am repeating some of the points that I thought were relevant.]



1. Dependencies are not the same as constraints.

2. Both dependencies and constraints can be thought of as relationships between variables (or observables).

3. Dependencies are relationships that have a direction. If we consider the example of a = b + c then changes to b or c will update a, but not vice-versa. There is no way to change a and effect b or c.

4. Constraints are often multi-directional. If we consider a constraint a = b, then changing b will cause a change to a, and changing a will cause a change to b. The relationship is always maintained.

5. A dependency maintainer is a machine that simply maintains the dependencies at all times. At no point is there a state (that is visible to the user) where a can be any value other than b + c. It is a requirement of dependencies that they are maintained indivisibly.

6. A constraint maintainer is more complicated than a dependency maintainer. Firstly it requires more information about updating constraints. If there is a change to a in a = b + c, then it must decide to update either b or c in order to maintain the constraint. The programmer must understand this to create valid constraints, and must have a knowledge of the constraint maintainance methods. This may lead to undecidability issues when making updates.



No comments:

Post a Comment