Hi,

First of all, I think the ideas in Avalon are really excellent, and the
implementation just as good.  I am trying to gradually migrate my existing
system to use the framework.  What I really like about it is the order it
imposes on my development practise and the systems that result from that
practise.  But I would like to get even more ordered, and wanted to bounce
an idea I have off you all.

The system that I am currently working on is one vast prairie on public
classes and methods.  Anything can call anything else, and usually does,
resulting in circular dependencies and all kinds of mess.  This is as much
my fault as anybody elses, but thats beside the point.

If we take Avalon into use, we can move to a situation where we can have
components collaborating together in a much more ordered manner.  But there
is still some possibility for a Component implemenation to just go right
ahead and request any old component from the ComponentManager or to
instantiate any public class that is anywhere in the classpath.  What I have
in mind a total lock down along these lines.

 * The constructors for all the component implemenations are private.  There
are no constructors of scope greater than package protected.
 * The ComponentManager instantiates component instances using reflection
and setAccessible(true) to bypass the private scoping
 * When a Component requests an instance of another component, it passes
itself to the ComponentManager as a parameter.  The ComponentManager checks
if the requesting component is permitted, as per a config file, to use the
requested component before proceeding.  So, component relationships are made
explicit.
 * Components are implemented as much as possible in a single package, which
all constituent classes having package protected scope.  This makes these
classes available only to the component impl, and reduces the possibility of
just going ahead and constructing a class because its handy to do so.  Of
course, the reality is that component implementations will surely involve
cooperating packages with publically exposed methods, particularly when it
comes to using third part libs.

ANyway, I just wanted to hear what you thought about this, and whether there
is any room for this kinda thing in Avalon, especially the "privitization"
of constructors.  Or whether the thing is plainly impractical or just
plainly unneeded - I have yet to prove the case either way.

Thanks,
Mike.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to