Dan Creswell wrote:
 A factory makes it nice and easy to get what one is after whilst providing
a
layer of separation that affords a lot of flex in building exactly what's
required.

Shall we go for a 'protected' for both registrar implementations then?
Because if you want to work with the binary dist, and stay out of the
package space for river, work without reflection, you need to have some
access.


Okay, works for me.

Sorry people, I haven't been paying much attention, Queensland's is experiencing some of it's wettest monsoon rains on record.

With respect to protected, I don't think that's a good idea, it forces you to extend something not designed for extension.

Which methods do you need public, or is it just the constructor you need?

Using reflection to create objects is sometimes a good option, especially if a no arg constructor can be provided, performance is not so good for accessing methods though. I like the idea of providing a factory, with a static method that returns a Registrar.

If we need to replace the RegistrarImpl at some point, we can change the Factory, without needing to change the client.

The Factory might discover the Registrar using an SPI, in which case the client is still abstracted from the Registrar implementation and can be discovered at runtime.

We can make the factory part of the distribution, perhaps as part of Discovery, so the use of a local registrar becomes part of configuration and deployment rather than development.

There are probably others who could use a local registrar as Sim has suggested, it might be good for testing during development etc.

Just some thoughts.

Cheers,

Peter.

Reply via email to