I want to write a factory method to instantiate an entity that is an aggregate root.
Should the method accept the aggregated child entities and values as instantiated objects, or should it accept only primitive types?
For example, if I had an entity Computer composed of a Processor and a Memory object, should the factory method take the form:
public Computer NewComputer(
string computerName,
int processorCores,
int processorClockSpeed,
string memoryType,
int memoryRam)
{
...
}
or
public Computer NewComputer(
string computerName,
Processor processor,
Memory memory)
{
...
}
Is it only a matter of taste, or are there any serious considerations here?