Strategy Pattern with Generics
Newsletter by Heinz Kabutz, 7 pages, 45 minutes.
This newsletter covers a complex topic: writing generic interfaces and classes in Java. Although using generics is normally pretty easy, I find writing generic code rather dificult. The article gives a good case for using generics in combination with the Strategy pattern to avoid downcasts. While I think the amount of code and hard-to-read generics syntax in this case outweighs the loosing of a downcast, I can imagine cases where this approach would be worth its weight.
read it
This newsletter covers a complex topic: writing generic interfaces and classes in Java. Although using generics is normally pretty easy, I find writing generic code rather dificult. The article gives a good case for using generics in combination with the Strategy pattern to avoid downcasts. While I think the amount of code and hard-to-read generics syntax in this case outweighs the loosing of a downcast, I can imagine cases where this approach would be worth its weight.
read it
0 Comments:
Post a Comment
<< Home