This is an old revision of the document!
Caching: Invalidate (part II)
Task: Pass tests.Invalidation2a
and pass tests.Invalidation2b
.
Of course, the previous aspect didn't really solve the problem. What if a Point
that is part of a Group
moves? Whenever either of the fields of a Point
are set it should invalidate the caches of all enclosing groups.
Group
as a newly introduced field of a FigureElement
(intercept the add()
method of Group
to populate this field). When the FigureElement
moves, the cache of its enclosing group should be invalidated.
A correct implementation should at least pass the tests of suite tests.Invalidation2a
. However, check if you really did it correctly by also running the suite tests.Invalidation2b
. If you pass, congratulations! Otherwise, you have fallen prey to our cruel trap: Remember that whenever a point moves it should invalidate the caches of all enclosing groups (recursively).
When done, remove your aspects from the build path and return to the Overview.