From: Ian S. <Ian...@ar...> - 2003-05-19 17:38:47
|
Hi, While building defaultcore, I found that it fails because the ToolListImplTest throws a bunch of NullPointerExceptions. This of course is because an exception was eaten in the ToolFactory. Before rehashing my exception spiel, I pondered why it is a factory is needed for tools. I never reached a conclusive answer. It seems that in all other gui apis, you pick and choose your implementations. Interfaces define the protocol and contract between the moving pieces, the user picks the implementation. The factory approach buys nothing but confusion here. In addition, the usage of a non-qualified System property will, given enough monkeys, some typewriters, and enough time, will be stepped on. Ex. System.getProperty("thing") MONKEY PRONE System.getProperty("foo.bar.baz.thing") MONKEY RESISTANT ------------------------------------------------------- While mucking around with shapefile, I noticed the anti-pattern usage of FeatureFactory and FeatureTypeFactory. These classes are in defaultcore. Because each DataSource uses these classes, they are also tied to defaultcore. It seems that to be of any use, a factory should reside with the interfaces it produces implementations of... So as it is, this prevents client code form providing an implementation other than FlatFeature (maybe allowing mutability for some custom application). Ian |