The Co SI An Alternative to Property Change

  • Slides: 133
Download presentation
The Co. SI: An Alternative to Property Change Listening Presented by: Gary Curtis Andrew

The Co. SI: An Alternative to Property Change Listening Presented by: Gary Curtis Andrew Spina

Co. SI Agenda • • Why did we write it? What is it? How

Co. SI Agenda • • Why did we write it? What is it? How does it work? The Co. SI versus Property. Changes – Both in Action (with Code examples) • Advanced Co. SI Features • Future Direction

What do we want to do: APT

What do we want to do: APT

What do we want to do: APT User enters data into fields using editors.

What do we want to do: APT User enters data into fields using editors.

What do we want to do: APT User enters data into fields using editors.

What do we want to do: APT User enters data into fields using editors.

What do we want to do: Diagnostics show problems with entered data.

What do we want to do: Diagnostics show problems with entered data.

What do we want to do: Diagnostics They also explain what is wrong.

What do we want to do: Diagnostics They also explain what is wrong.

What do we want to do: Diagnostics The diagnostic accesses data to decide if

What do we want to do: Diagnostics The diagnostic accesses data to decide if it should display.

What do we want to do: Diagnostics It might access multiple fields.

What do we want to do: Diagnostics It might access multiple fields.

What do we want to do: Diagnostics It might access multiple fields.

What do we want to do: Diagnostics It might access multiple fields.

What do we want to do: Diagnostics It might access multiple fields.

What do we want to do: Diagnostics It might access multiple fields.

What do we want to do: Diagnostics But there is a problem…

What do we want to do: Diagnostics But there is a problem…

What do we want to do: Diagnostics The diagnostic needs to know when a

What do we want to do: Diagnostics The diagnostic needs to know when a field changes.

What do we want to do: Diagnostics The diagnostic needs to know when a

What do we want to do: Diagnostics The diagnostic needs to know when a field changes.

What do we want to do: Diagnostics How does the diagnostic find out about

What do we want to do: Diagnostics How does the diagnostic find out about changes?

What do we want to do: Diagnostics APT used Property Changes (common in Java).

What do we want to do: Diagnostics APT used Property Changes (common in Java).

What do we want to do: Diagnostics They are hard to maintain, cumbersome, and

What do we want to do: Diagnostics They are hard to maintain, cumbersome, and no fun to write.

What do we want to do: Diagnostics So we wrote the Co. SI.

What do we want to do: Diagnostics So we wrote the Co. SI.

What is it? • Co. SI - Constraint Sequencing Infrastructure • Consists of 3

What is it? • Co. SI - Constraint Sequencing Infrastructure • Consists of 3 parts: – Property – Constraint – Propagator • More declarative than Property Changes • Less boiler plate code too • Self contained Java Plugin (Cosi. jar)

How does it work: Properties Hi! I’m a property.

How does it work: Properties Hi! I’m a property.

How does it work: Properties I have a value. 10

How does it work: Properties I have a value. 10

How does it work: Properties I’m Generic so my Value has a Type 10

How does it work: Properties I’m Generic so my Value has a Type 10 (Integer)

How does it work: Properties I’m light weight so Make lots of me. 10

How does it work: Properties I’m light weight so Make lots of me. 10 (Integer)

How does it work: Properties I’m light weight so Make lots of me. 10

How does it work: Properties I’m light weight so Make lots of me. 10 + (Integer) (Operand)

How does it work: Properties I’m light weight so Make lots of me. 10

How does it work: Properties I’m light weight so Make lots of me. 10 + 20 (Integer) (Operand) (Integer)

How does it work: Properties I’m light weight so Make lots of me. 10

How does it work: Properties I’m light weight so Make lots of me. 10 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Properties What happens when I change? 10 + 20 =

How does it work: Properties What happens when I change? 10 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Properties What happens When I change? ! 25 + 20

How does it work: Properties What happens When I change? ! 25 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Properties Wait! Now I’m wrong! ! 25 + 20 =

How does it work: Properties Wait! Now I’m wrong! ! 25 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Constraints Don’t worry! That’s my job. ! 25 + 20

How does it work: Constraints Don’t worry! That’s my job. ! 25 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Constraints I’m a constraint ! 25 + 20 = 30

How does it work: Constraints I’m a constraint ! 25 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Constraints My job is to ensure something is true. !

How does it work: Constraints My job is to ensure something is true. ! 25 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Constraints I do this by accessing And changing properties !

How does it work: Constraints I do this by accessing And changing properties ! 25 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Constraints In this case I would Access 3 properties !

How does it work: Constraints In this case I would Access 3 properties ! 25 + 20 = 30 (Integer) (Operand) (Integer)

How does it work: Constraints and change one property. 25 + 20 = 45

How does it work: Constraints and change one property. 25 + 20 = 45 (Integer) (Operand) (Integer)

How does it work: Constraints Now I look like a tree! 45 (Integer) =

How does it work: Constraints Now I look like a tree! 45 (Integer) = 25 + 20 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) Properties and Constraints can generate complex dependency

How does it work: Constraints 5 (Integer) Properties and Constraints can generate complex dependency graphs = 45 / 9 (Integer) (Operand) (Integer) = = 25 + 20 11 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) = 45 / 9 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) = 45 / 9 (Integer) (Operand) (Integer) = = What happens if I change? 25 + 20 11 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) = 45 / 9 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) = 45 / 9 (Integer) (Operand) (Integer) = = What happens if I change? 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) = 45 / 9 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) = 45 / 9 (Integer) (Operand) (Integer) = ! = Then we need to be run again because our dependencies changed. ! 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) = 45 / 9 (Integer) (Operand) (Integer)

How does it work: Constraints 5 (Integer) = 45 / 9 (Integer) (Operand) (Integer) = ! = Which of us goes first? ! 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Enter the Propagator! = 45 / 9

How does it work: Propagator 5 (Integer) Enter the Propagator! = 45 / 9 (Integer) (Operand) (Integer) = ! 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) My job is to execute the constraints

How does it work: Propagator 5 (Integer) My job is to execute the constraints that need to be run. = 45 / 9 (Integer) (Operand) (Integer) = ! 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) I do this by maintaining a queue

How does it work: Propagator 5 (Integer) I do this by maintaining a queue of out of date constraints. = 45 / 9 (Integer) (Operand) (Integer) = ! 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) I do this by maintaining a queue

How does it work: Propagator 5 (Integer) I do this by maintaining a queue of out of date constraints. = 45 / 9 (Integer) (Operand) (Integer) = ! Queue 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) I do this by maintaining a queue

How does it work: Propagator 5 (Integer) I do this by maintaining a queue of out of date constraints. = 45 / 9 (Integer) (Operand) (Integer) = ! Queue = 25 + 23 11 (Integer) (Operand) (Integer) =

How does it work: Propagator 5 (Integer) I also know which constraint is currently

How does it work: Propagator 5 (Integer) I also know which constraint is currently running. = 45 / 9 (Integer) (Operand) (Integer) = ! Queue = 25 + 23 11 (Integer) (Operand) (Integer) =

How does it work: Propagator 5 (Integer) I also know which constraint is currently

How does it work: Propagator 5 (Integer) I also know which constraint is currently running. = Current Constraint 45 / 9 (Integer) (Operand) (Integer) = ! Queue = 25 + 23 11 (Integer) (Operand) (Integer) =

How does it work: Propagator 5 (Integer) The Current Constraint comes from the Queue.

How does it work: Propagator 5 (Integer) The Current Constraint comes from the Queue. = Current Constraint 45 / 9 (Integer) (Operand) (Integer) = ! Queue = 25 + 23 11 (Integer) (Operand) (Integer) =

How does it work: Propagator 5 (Integer) The Current Constraint comes from the Queue.

How does it work: Propagator 5 (Integer) The Current Constraint comes from the Queue. = Current Constraint 45 / 9 (Integer) (Operand) (Integer) = ! = Queue = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Running it may change some properties =

How does it work: Propagator 5 (Integer) Running it may change some properties = Current Constraint 45 / 9 (Integer) (Operand) (Integer) = ! = Queue = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Running it may change some properties =

How does it work: Propagator 5 (Integer) Running it may change some properties = Current Constraint 45 / 12 (Integer) (Operand) (Integer) = ! = Queue = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Which may queue some constraints. = Current

How does it work: Propagator 5 (Integer) Which may queue some constraints. = Current Constraint 45 / 12 (Integer) (Operand) (Integer) = ! = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) When one constraint is done, the next

How does it work: Propagator 5 (Integer) When one constraint is done, the next is run. = Current Constraint 45 / 12 (Integer) (Operand) (Integer) = ! = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) When one constraint is done, the next

How does it work: Propagator 5 (Integer) When one constraint is done, the next is run. = Current Constraint 45 / 12 (Integer) (Operand) (Integer) = ! Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) When one constraint is done, the next

How does it work: Propagator 5 (Integer) When one constraint is done, the next is run. = Current Constraint 45 / 12 (Integer) (Operand) (Integer) = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Which may change a different property. =

How does it work: Propagator 5 (Integer) Which may change a different property. = Current Constraint 45 / 12 (Integer) (Operand) (Integer) = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Which may change a different property. =

How does it work: Propagator 5 (Integer) Which may change a different property. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Which may queue more constraints. = Current

How does it work: Propagator 5 (Integer) Which may queue more constraints. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator But I’m already queued! 5 (Integer) Which may queue

How does it work: Propagator But I’m already queued! 5 (Integer) Which may queue more constraints. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator But I’m already queued! 5 (Integer) Which may queue

How does it work: Propagator But I’m already queued! 5 (Integer) Which may queue more constraints… or may not. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Propagation continues until the queue is empty.

How does it work: Propagator 5 (Integer) Propagation continues until the queue is empty. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) = Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Propagation continues until the queue is empty.

How does it work: Propagator 5 (Integer) Propagation continues until the queue is empty. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) Queue = = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 5 (Integer) Propagation continues until the queue is empty.

How does it work: Propagator 5 (Integer) Propagation continues until the queue is empty. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) = Queue = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 4 (Integer) Propagation continues until the queue is empty.

How does it work: Propagator 4 (Integer) Propagation continues until the queue is empty. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) = Queue = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work: Propagator 4 (Integer) Propagation continues until the queue is empty.

How does it work: Propagator 4 (Integer) Propagation continues until the queue is empty. = Current Constraint 48 / 12 (Integer) (Operand) (Integer) Queue = = 25 + 23 11 (Integer) (Operand) (Integer)

How does it work? Some Details: • Propagation begins when a property is changed.

How does it work? Some Details: • Propagation begins when a property is changed. • Propagation ends when the queue is empty. • Dependencies are Automatic – When a constraint accesses a property is is dependent on it. • Dependencies are Dynamic – When a constraint runs new dependencies may be added and old ones may be removed. • Thread safe – Assuming your constraints are threadsafe • Any Questions so far?

Co. SI vs. Property Changes

Co. SI vs. Property Changes

Co. SI vs. Property Changes

Co. SI vs. Property Changes

Co. SI Demo vs. Property Changes

Co. SI Demo vs. Property Changes

Co. SI vs. Property Changes

Co. SI vs. Property Changes

Co. SI Fields vs. Property Changes

Co. SI Fields vs. Property Changes

Co. SI Cosi. Double wraps a Double and informs The Cosi of changes to

Co. SI Cosi. Double wraps a Double and informs The Cosi of changes to that Double. vs. Property Changes

Co. SI Cosi. Object can wrap anything because of Generics. vs. Property Changes

Co. SI Cosi. Object can wrap anything because of Generics. vs. Property Changes

Co. SI vs. Properties have names. Property Changes

Co. SI vs. Properties have names. Property Changes

Co. SI vs. Property. Change. Support is used to enable Property. Change. Events Property

Co. SI vs. Property. Change. Support is used to enable Property. Change. Events Property Changes

Co. SI vs. Property Changes Getters and Setters

Co. SI vs. Property Changes Getters and Setters

Property Changes

Property Changes

Property Changes make new and old value available

Property Changes make new and old value available

Property Changes must be fired explicitly

Property Changes must be fired explicitly

Property Changes Getters are very simple

Property Changes Getters are very simple

Co. SI

Co. SI

Co. SI Calling set() causes propagation and stores the new value

Co. SI Calling set() causes propagation and stores the new value

Co. SI Calling get() registers a dependency on f. X 1 and returns the

Co. SI Calling get() registers a dependency on f. X 1 and returns the accessed value.

Co. SI Calculation vs. Property Changes

Co. SI Calculation vs. Property Changes

Co. SI Very Similar Logic vs. Very Similar Logic Property Changes

Co. SI Very Similar Logic vs. Very Similar Logic Property Changes

Co. SI vs. Must store old value so a property change can be constructed

Co. SI vs. Must store old value so a property change can be constructed Property Changes

Co. SI Annotation identifies this as a constraint to the infrastructure. vs. Property Changes

Co. SI Annotation identifies this as a constraint to the infrastructure. vs. Property Changes

Co. SI Accessing f. X 1, f. X 2 and f. Op register dependencies.

Co. SI Accessing f. X 1, f. X 2 and f. Op register dependencies. Constraint will run again if they change. vs. Property Changes

Co. SI Calling set() will queue any constraints which call f. Result. get() vs.

Co. SI Calling set() will queue any constraints which call f. Result. get() vs. Property Changes

Co. SI Who calls these methods? vs. Property Changes

Co. SI Who calls these methods? vs. Property Changes

Co. SI makes calls automatically when a dependency changes. vs. You make calls with

Co. SI makes calls automatically when a dependency changes. vs. You make calls with a Property Change Listener like this… Property Changes

Co. SI makes calls automatically when a dependency changes. vs. You make calls with

Co. SI makes calls automatically when a dependency changes. vs. You make calls with a Property Change Listener like this. Property Changes

Co. SI vs. The Listener is initialized during construction. Property Changes

Co. SI vs. The Listener is initialized during construction. Property Changes

Co. SI vs. Dependencies are declared explicitly. Property Changes

Co. SI vs. Dependencies are declared explicitly. Property Changes

Co. SI Dependencies are discovered automatically when get() is called. vs. Property Changes

Co. SI Dependencies are discovered automatically when get() is called. vs. Property Changes

Co. SI Misc vs. Property Changes

Co. SI Misc vs. Property Changes

Co. SI vs. Need methods which enable Property Change Listening. Property Changes

Co. SI vs. Need methods which enable Property Change Listening. Property Changes

Co. SI Tells the Cosi when initialization of this object is complete. Always at

Co. SI Tells the Cosi when initialization of this object is complete. Always at the end of an objects constructor. vs. Property Changes

Co. SI This tells the Cosi that an object is initialized. Once an object

Co. SI This tells the Cosi that an object is initialized. Once an object is initialized, the Cosi initializes constraints on that object. vs. Property Changes

A subclass would have this: Co. SI vs. Property Changes

A subclass would have this: Co. SI vs. Property Changes

Co. SI Always use a statically defined class. (never use get. Class()) vs. Property

Co. SI Always use a statically defined class. (never use get. Class()) vs. Property Changes

Co. SI Updating the vs. GUI Property Changes

Co. SI Updating the vs. GUI Property Changes

Co. SI vs. Property Change Listeners register explicit dependencies. Property Changes

Co. SI vs. Property Change Listeners register explicit dependencies. Property Changes

Co. SI vs. They execute certain code when a property changes. Property Changes

Co. SI vs. They execute certain code when a property changes. Property Changes

Co. SI One Listener for each GUI widget vs. Property Changes

Co. SI One Listener for each GUI widget vs. Property Changes

Co. SI One Listener for each GUI widget vs. Property Changes

Co. SI One Listener for each GUI widget vs. Property Changes

Co. SI Uses a constraint to update. If f. Results in the Data Model

Co. SI Uses a constraint to update. If f. Results in the Data Model changes the constraint runs again. vs. Property Changes

Co. SI One constraint for each GUI widget vs. Property Changes

Co. SI One constraint for each GUI widget vs. Property Changes

Co. SI One constraint for each GUI widget vs. Property Changes

Co. SI One constraint for each GUI widget vs. Property Changes

Co. SI One constraint for each GUI widget vs. Property Changes

Co. SI One constraint for each GUI widget vs. Property Changes

Co. SI Advanced Features • Mutable v Immutable Objects – Co. SI Collections •

Co. SI Advanced Features • Mutable v Immutable Objects – Co. SI Collections • Co. SI Derived Properties • Co. SI Property Change Support

Mutable v Immutable Objects • Cosi. Object<T> wraps an instance of T – immutable

Mutable v Immutable Objects • Cosi. Object<T> wraps an instance of T – immutable objects • What about mutable objects? – can change internally – Cosi. Object wouldn’t know • Vector example: final Cosi. Object<Vector> cosivector = new Cosi. Object(new Vector()); cosivector. get(); // Seen by Co. SI cosivector. set(new Vector()); // Seen by Co. SI cosivector. get(). add(“string”); // Not seen by Co. SI

Mutable Objects • Java and other third party classes may be mutable. . .

Mutable Objects • Java and other third party classes may be mutable. . . –. . . but they will notify Co. SI • Cosi notification for mutable objects are added via adapters that: – handle Co. SI notification – delegate to the backing object • Adapters for a number of core Java classes are provided with Co. SI

Co. SI Collections • Collections are ubiquitous – Vector, Hash. Map, Linked. Lists. .

Co. SI Collections • Collections are ubiquitous – Vector, Hash. Map, Linked. Lists. . . • Co. SI provides adapters that implement the Java Collections interfaces: – Set, List, Map and Queue – backed by a Java implementation • Factories are provided for most built in Collections classes – Cosi. Map. hash. Map() • Can be smart about their notifications

Co. SI Map Example • Co. SI Maps can provide fine grained notification: Hash.

Co. SI Map Example • Co. SI Maps can provide fine grained notification: Hash. Map map = Cosi. Map. hash. Map(); @Cosi. Constraint private constraint 1 () { for (String string : map) { do. Something(string); }} @Cosi. Constraint private constraint 2 () { do. Something(map. get(“key 1”)); } • constraint 1 depends on whole map • constraint 2 depends on “key 1” key • map. put(“key 3”, “string”) – constraint 1 is run, constraint 2 is not

Co. SI Derived Property • Many constraints compute single value • Co. SIDerived. Property

Co. SI Derived Property • Many constraints compute single value • Co. SIDerived. Property provides memoization for that value: Cosi. Property exptime = new Derived. Property (this, 0, new Exp. Time. Calculator()); –a constraint runs the Exp. Time. Calculator –the value of the property is the return value of Exp. Time. Calculator. calculate() –set() not supported

Co. SI Property Change Support Constraints and property change listeners are somewhat analogous. 18

Co. SI Property Change Support Constraints and property change listeners are somewhat analogous. 18 c 2 = p 1 6 + Either c 1 or c 2 could be a constraint, or a property change listener. 12 = c 1 23 - 11 As constraints, c 2 depends on p 1 and c 1 does not.

Co. SI Property Change Support What if c 2 is a property change listener?

Co. SI Property Change Support What if c 2 is a property change listener? 18 c 2 = p 1 6 + As c 2 runs within the scope of c 1, a dependency will be established between c 1 and p 1. 12 = c 1 23 - 11 Need a way to suppress dependencies in property change listeners.

Co. SI Property Change Support • Property change listeners and constraints should handle their

Co. SI Property Change Support • Property change listeners and constraints should handle their own dependencies • Co. SI provides a mechanism to decouple property change listeners from constraints • Cosi. Property. Change. Support extends Property. Change. Support to provide: – suppression of dependency tracking – does not suppress propagation • Cosi. Property. Change. Support should be used when a Cosi Property needs to fire property change events

Future Enhancements • Priority Queue Propagation • Lazy Propagation • Co. SI Debugging

Future Enhancements • Priority Queue Propagation • Lazy Propagation • Co. SI Debugging

25 48 12 = = + 23 48 25 + - Co. SI Propagator

25 48 12 = = + 23 48 25 + - Co. SI Propagator can control constraint execution order. 11 12 23 - vs. Change firing order is arbitrary 11 Property Changes

Priority Queue 35 c 2 = 12 p 2 By queuing constraints Co. SI

Priority Queue 35 c 2 = 12 p 2 By queuing constraints Co. SI avoids unnecessary work in some case. Can it do better? = c 1 + p 1 33 - 11

Priority Queue Changing p 1 queues c 1 and c 2 but in which

Priority Queue Changing p 1 queues c 1 and c 2 but in which order? 35 c 2 = 12 p 2 = c 1 + p 1 33 - 11 If c 2 goes first it will run twice because c 1 changes p 2. Prefer c 1 to be queued ahead of c 2.

Priority Queue The propagator knows which constraint is running. 35 c 2 = 12

Priority Queue The propagator knows which constraint is running. 35 c 2 = 12 p 2 = c 1 + p 1 33 - 11 If we assign constraints a priority, then when c 1 causes c 2 to be queued the propagator can assign it a lower priority.

Lazy Propagation 4 p 4 If p 1, p 2, or p 3 change,

Lazy Propagation 4 p 4 If p 1, p 2, or p 3 change, we start propagation. = 48 / = 25 p 1 + If all are changed by a non constraint we propagate 3 times. 12 = 23 p 2 - 11 p 3 However, if the value of p 4 is not immediately needed, propagation could be delayed.

Lazy Propagation • To defer propagation, we need to determine when a property is

Lazy Propagation • To defer propagation, we need to determine when a property is needed – If a property is accessed outside of propagation, we need to propagate • GUI updates are a problem – Components listen, don’t poll properties – GUI constraints could be briefly deferred to the Swing thread. • Possible approaches: – Explicit deferral of propagation – Partition constraint space into deferrable and non deferrable portions.

Co. SI Debugging • Potential Co. SI problems – Understanding dependencies – Infinite loops

Co. SI Debugging • Potential Co. SI problems – Understanding dependencies – Infinite loops • Being centralized, the propagator provides a location for debugging.

Co. SI Debugging • Hooks are available for observing Co. SI: – Starting and

Co. SI Debugging • Hooks are available for observing Co. SI: – Starting and stopping propagation – Dependency notification – Running constraint • A prototype debugging GUI has been built supporting: – Realtime reporting – Simple inspection – History logging • Expect to enhance in the future

Final Notes: -Presentation, sample code and Cosi. jar will be available at: http: //apst.

Final Notes: -Presentation, sample code and Cosi. jar will be available at: http: //apst. stsci. edu/apt/documents/cosi/ -If enough interest is generated, a workshop or repeat presentation are available Thank You

Co. SI Features: Collections

Co. SI Features: Collections

25 48 12 = = + 23 48 25 + - Co. SI 11

25 48 12 = = + 23 48 25 + - Co. SI 11 12 23 - 11 Propagator can control constraint execution order. vs. Change firing isn’t centralized so ordering is arbitrary Property Changes

Final Notes: -Presentation, sample Code and Cosi. jar available at: <Insert URL Here> -If

Final Notes: -Presentation, sample Code and Cosi. jar available at: <Insert URL Here> -If enough interest is generated, a workshop and/or repeat presentation are available Thank You