You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by Thomas Koch <th...@koch.ro> on 2012/01/24 16:42:32 UTC

Confusing inheritence in abdera2

Hi,

please excuse me for spamming the list, but I'll be away for a few days now 
and so I thought I get this out before. Please tell me, if my review is not 
helping.

I don't know the Abdera1 code, but may it be possible, that Abdera2 overuses 
inheritence? For me as a newcomer it seems extremly difficult to grasp the API 
with so many levels and directions of inheritence.

Have a look at the type hierarchy of 
org.apache.abdera2.common.protocol.CollectionInfo: There are 44 types and the 
inheritence goes 5 levels down.

Take org.apache.abdera2.protocol.server.impl.SimpleWorkspaceInfo as an 
example. It extends BasicWorkspaceInfo only to add one converter method 
asWorkspaceElement(). But to achieve this, it needs to add a full screen of 
boilerplate code.

An alternative would be to have one Converter class with one convert(Type) 
method per type. This converter could then also hold the Abdera factory 
instance which is currently grapped by asWorkspaceElement() from the global 
name space.

Would you accept a patch for this? Should I fill an issue?
Please compare EffectiveJava Item 16: Favor composition over inheritance.

Best regards,

Thomas Koch, http://www.koch.ro