struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Geary <sabrew...@tri-lakesonline.net>
Subject Options1: Just Say No (was Re: cvs commit: jakarta-struts/web/documentation tags.html)
Date Mon, 17 Jul 2000 17:11:14 GMT
craigmcc@locus.apache.org wrote:

> craigmcc    00/07/16 15:49:23
>
>   Modified:    src/conf struts.tld
>                web/documentation tags.html
>   Added:       src/share/org/apache/struts/taglib MultiboxTag.java
>                         Options1Tag.java
>   Log:
>   Add two new custom tags to the Struts library:
>
>   <struts:options1> is a version of <struts:options> that is compatible with
>   JDK 1.1, and can enumerate over an array, a Dictionary (including a
>   Hashtable), an Enumeration, or a Vector.

I'm sorry, but this is horrible. Why? For the same reason that struts tags are not named tag1,
tag2, tag3, ...

We have EnumerateTag, which is for 1.1, and IterateTag, which is for 1.2. That's bad enough,
but at least it's apparent which tag
applies to what version of the JDK; that is, if you know that Iterator was added in 1.2, and
you understand that there is no difference
between EnumerateTag and IterateTag except for their private iteration algorithm, which really
should be nobody's business but their
own.

Now we have OptionsTag and Options1Tag, which share all of the drawbacks that EnumerateTag
and IterateTag exhibit, but in addition:
Which tag is for 1.1 and which is for 1.2?

Please don't force me to select which JDK version is supported by struts tags by using different
tags with obscure names. All struts
tags should work with both 1.1 and 1.2 collections. Developers shouldn't even have to think
about it.

The worst part of all this is that a simple implementation of the Adapter design pattern can
eliminate all of the duplicate classes,
leaving us with just IterateTag and OptionsTag.

david


Mime
View raw message