In the latest Java Specialists' Newsletter, we debate why you should write generics code such as class TaxPayer<P extends TaxPayer<P>>. Is it necessary, or would class TaxPayer<P extends TaxPayer> have been sufficient?
In the latest Java Specialists' Newsletter we look at how we can elegantly solve some
problems of the Strategy Pattern using Java 5 Generics.
The Strategy Pattern is elegant in its simplicity. With this
pattern, we should try to convert intrinsic state to
extrinsic, to allow sharing of strategy objects. It gets
tricky when each strategy object needs a different set of
information in order to do its work. In this newsletter, we
look at how we can use Java 5 Generics to pass the correct
subtype of the context into each strategy object.
Please also have a look at the discussion on
around these questions.