I have a class that has to take product information from one system's database and save it to another system's product database.
I'll call a product from the first system Product A and the other Product B. Product B's data depends on settings selected from a user.
So Product B may have a GetDescriptions method that looks at a user setting that says use Description1 variable from Product A or they could select Description 2 or they could use the Description already in Product B.
This is fine, but there are a lot of settings and ways to get description. This is the problem, I have a lot of methods that all seem to pertain to Product B. Methods like GetDescription, GetName, GetSku, that are all set according to user settings and all depend on Product A.
Although they all seem to relate to Product B, the class is growing very large and I want to move some of the methods out of the class into another class. I was thinking about using the Factory pattern. Something like below (code just a quick idea)
public class ProductBuilder
{
public ProductB BuildProduct()
{
SkuBuilder.BuildSku(ProductB,ProductA);
ProductDescriptionBuilder.BuildDescription(ProductB,ProductA);
}
}
My questions are: What is a good design for this? Is the method I've proposed above acceptable? Do you see any potential problems with this design?