L
lordy
If I have some code that does this during in initialisation
1. Create lots of Object A
2. Create lots of Object B that each refers to a subset of instances of A.
Then I later realise that the A's must be distinct for each B. Is it
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.
I'm tempted to think the latter. Cloning looks easy to make mistakes
(esp if someone later adds a new field without checking if it needs to
be deep-copied etc).
Lordy
1. Create lots of Object A
2. Create lots of Object B that each refers to a subset of instances of A.
Then I later realise that the A's must be distinct for each B. Is it
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.
I'm tempted to think the latter. Cloning looks easy to make mistakes
(esp if someone later adds a new field without checking if it needs to
be deep-copied etc).
Lordy