User Tools

Site Tools


caching:ex4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

caching:ex4 [2008/10/07 14:23]
bdefrain
caching:ex4 [2021/02/05 13:51]
Line 1: Line 1:
-====== 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. 
- 
-<note tip> 
-Store the enclosing ''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 (if there is an enclosing group and if there is a cache value for this group). 
-</note> 
- 
-<note warning> 
-If you use ''aspectOf'', but no corresponding aspect instance can be found, the AspectJ runtime will throw the [[http://www.eclipse.org/aspectj/doc/released/runtime-api/org/aspectj/lang/NoAspectBoundException.html|NoAspectBoundException]]. (Catching this exception is a way to test whether there is an aspect instance available.) 
-</note> 
- 
-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 [[:start|Overview]]. 
  
caching/ex4.txt ยท Last modified: 2021/02/05 13:51 (external edit)