commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <b...@systemoutprintln.de>
Subject [SANDBOX][BeanUtils2] Thoughts about AccessibleObjectsRegistry
Date Fri, 27 Jan 2012 16:56:07 GMT
Hi,

now, that I have made myself more familiar with BeanUtils2, there are a 
few things worth discussing regarding AccessibleObjectsRegistry.

Complex methods: I know, that BeanUtils2 is just an experiment, and that 
the code was written to get it working fast for this purpose. But some 
methods are really hard to read. Take for example resolve() on 
MethodsRegistry. There are at least two things happening: 1. try to find 
a direct match, 2. if no direct match can be found, start a some how 
more complex search. I think this could be separated into several 
methods. If you agree, I can create an issue and write a patch.

Magic numbers: I really don't understand, how object transformation 
costs get calculated in MethodsRegistry.getObjectTransformationCosts. 
What does 0.25f mean? And why do we add 1.5f? Are this values you came 
up with from the development of BeanUtils1? If so, this should be 
documented in the code.

Terminology: I really don't like the name of the class. My opinion is, 
that the term "object" should never be overloaded. The problem is, that 
AccessibleObjects refer to methods and constructors that are accessible 
from the caller (e.g. public for a caller outside the containing package 
of the bean class). Now, if you are new to BeanUtils2, your first 
thought might be, that those registries are holding objects, that are 
accessible themselves.
What I'm trying to say is, that maybe the name should be changed to 
something more convenient, for example "AccessibleOperationsRegistry". 
Since the general definition of a class is, that it defines the data and 
possible operations on that data for a set of similar objects, I think 
that name would be very appropriate (AccessibleObjectDescriptor, etc 
should be renamed likewise).

all the best
Benedikt

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message