Re: dispatch class, modularity, initialisation?
bugbear wrote:
Lew wrote:
That's a lot of typing if I want (say) 30 different
objects(instances) in the registry, where some
of them vary in ways that are trivially parameterisable.
e.g. days of week.
It's the same amount of typing whether you load one object or one
hundred. That's the beauty of algorithms - one block of code handles
arbitrary data set sizes.
I don't understand your objection.
Because in some cases, something may be easily expressed
by simply parameterising a class; your approach
(if I've understood) requires a separate class for
each instance in the registry (since you're using
Use Class.newInstance() with no parameters
as the only way to get an instance).
Creating a class, even using inheritance, just to
parameterise an instance, is what I'm suggesting
is a lot of typing.
It was not clear from your earlier posts that you were using the same class
with different parameters to configure each instance.
The same idea still works, just externalize the parameters. Jeez, doesn't
anyone extract an apply principles from fragmentary examples any more?
--
Lew