The Artima Developer Community
Sponsored Link

Doing Things with Java that Should Not Be Possible
Will Raw Types in Java Ever be Banned?
by Heinz Kabutz
March 15, 2006
Summary
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?

Advertisement

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 TheServerSide.com around these questions.

Talk Back!

Have an opinion? Be the first to post a comment about this weblog entry.

RSS Feed

If you'd like to be notified whenever Heinz Kabutz adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Heinz Kabutz enjoys driving Java to the limits, and then a bit beyond. He has been programming in Java since 1997 on several very unimportant projects. During that time, he has picked up some horrifying tips on how you can get the most out of Java. These are published on his bi-monthly "The Java(tm) Specialists' Newsletter" (http://www.javaspecialists.co.za). It is not for the uninitiated :-) Heinz received a PhD in Computer Science from the University of CapeTown. He loves living in South Africa as it is both beautiful and interesting. Professionally, Heinz survives by writing Java code, insulting, ahem, consulting, and presenting courses on Java and Design Patterns.

This weblog entry is Copyright © 2006 Heinz Kabutz. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us