Re: Another JUnit scenario
Rhino wrote:
....
I was looking at the source code for the Properties class, specifically
the list() methods (I finally took a minute to find out where the source
code in the Java API is again) and I didn't see any contructors for
writers or streams in there. Is Properties not a good class to imitate
for my situation then?
....
In general, you should not imitate classes, such as Properties, that
were designed very early in the life of Java. Many of them suffer from
at least one of two problems:
1. The initial Java API writers may have been very smart, but the
collective learning of the Java community over the years has often led
to better techniques.
In particular, they tend to depend too much on inheritance, rather than
composition. Making Properties extend Hashtable creates problems.
2. They are limited in their use of features added to the language since
they were defined.
Even if one were to expose the map aspects of Properties, it would
have been defined to implement Map<String,String>, rather than extend
Hashtable, if the Map interface and generics had existed when it was
defined. The Map optional methods that are undesirable for Properties,
put and putAll, would have thrown UnsupportedOperationException.
Patricia