I prefer option # 1, as this will reduce the number of parameters needed for the factory method. But my advice would be to use only the factory when the creation strategy is required for the population in question.
In one of your comments, you say:
".. but then I donβt understand the advantages of the factory. All it will do is just call the ComplexEntity constructor, and not create all the subcomponents that create it."
The factory's task is to make decisions on how to create an instance of the population by looking at the data passed to it. In my experience, the general scenario where this is required is where inheritance / polymorphism is used. For example, imagine that you have an abstract class Account with two subclasses: SavingsAccount and CurrentAccount. The factory's task is to decide which one should be created, given some data.
Another potential advantage of the factory is how expressive you are. If an aggregate can be created in several ways (i.e., using different arguments), then this can be better expressed with the method name in the factory than an overloaded constructor.
As I said, my advice is not to create a factory for each unit, if for one of the above reasons. Otherwise, as you indicated, this will be only one line, calling the constructor with the same arguments that are passed to it.
source share