I want to write a factory method to create an instance that is an aggregated root.
Should the method accept aggregated child entities and values ββas created objects or accept only primitive types?
For example, if I had a Computer object consisting of a processor and a memory object, the factory method takes 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 just a matter of taste, or are there any serious considerations here?
source
share