User Tools

Site Tools


caching:ex2

This is an old revision of the document!


Caching: Constant cache

Task: Pass tests.BoundsConstantCache.

Instead of making the (very) conservative approximation of getBounds() from the previous part, write an aspect instead that remembers the return value from the first time getBounds() has been called on a certain Group, and returns that first Rectangle for every subsequent call.

Use an inter-type declaration of a field on the Group class to store the cache value.

A correct implementation should pass the tests of suite tests.BoundsConstantCache.


Keep your aspect active and continue with Exercise 3.

caching/ex2.1172511164.txt.gz · Last modified: 2007/02/26 18:32 by bdefrain