Friday, February 13, 2009

FactoryFactories

Something somewhere went terribly wrong and we ended up with APIs like this.

http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/server/RequestProcessorFactoryFactory.html?rel=html

The default RequestProcessorFactoryFactory is the RequestProcessorFactoryFactory.RequestSpecificProcessorFactoryFactory. It creates a new processor instance for any request. In other words, it allows the request processor to have some state. This is fine, if the request processor is a lightweight object or needs request specific initialization. In this case, the actual request processor is created and invoked when calling RequestProcessorFactoryFactory.RequestProcessorFactory.getRequestProcessor(XmlRpcRequest).

The really sad part is that in the Java world this specific example cannot be considered that extreme any more.

FactoryFactories indeed.

2 comments:

Tgr said...

Why I Hate Frameworks (from 2005!)

videki said...

The are another icky parts with xmlrpc also - did u try to pass null values between two different implementations on different platforms on both sides through this "thing"? (God bless the spec to have to override the TypeConverters)