>> If I have some code that does this during in initialisation
>>
[quoted text clipped - 3 lines]
>>
>> Then I later realise that the A's must be distinct for each B. Is it
Do some of your Bs use their subsets of As before they later reduce to
depending on only one A?
If not (i.e., all Bs don't use As until they know one specific A they
must depend on) then it seems wasteful to have Bs depend on entire
subsets of A instances.
>> better to use cloning or should I re-organise the code so that B's are created
>> first and then unique A's can be generated as required.
[quoted text clipped - 10 lines]
>
> 2. Create lots of Object B that each calls AFactory to create unique As
This sounds like a better solution, though I'm not sure why you need
lots of AFactory objects; I presume you'll use a factory method to
create your As, so just one instance of AFactory should suffice.
>> Lordy

Signature
www.EdmundKirwan.com - Home of The Fractal Class Composition.
Download Fractality, free Java code analyzer:
www.EdmundKirwan.com/servlet/fractal/frac-page130.html
lordy - 07 Jul 2006 17:30 GMT
>> It turns out that some comments in my 'A' class already suggested
>> refactoring to introduce an AFactory object for other reasons. So perhaps a third
[quoted text clipped - 7 lines]
> lots of AFactory objects; I presume you'll use a factory method to
> create your As, so just one instance of AFactory should suffice.
Yes. Without some more context from me its probably a little confusing.
Rather than a factory object it would be better termed a Template or a
Type object. There a several of them. An each B requires its own unique
instances of an A derived from an arbitrary subset of ATemplates
(configurable)
Thanks,
Lordy