I have a class that should receive product information from one system database and store it in another system product database.
I will call the product from the first Product A system and another product B. Product B data depends on the settings selected by the user.
So product B may have a GetDescriptions method that looks at a user parameter that says it uses the Description1 variable from Product A, or they can select description 2 or they can use the description already in product B.
This is good, but there are many settings and ways to get a description. This is a problem, I have many methods that seem to apply to product B. Methods such as GetDescription, GetName, GetSku, they are all set according to user preferences, and it all depends on product A.
Although they all seem to be related to product B, the class is growing very large, and I want to transfer some of the methods from the class to another class. I was thinking about using the Factory pattern. Something like below (code is just a quick idea)
public class ProductBuilder
{
public ProductB BuildProduct()
{
SkuBuilder.BuildSku(ProductB,ProductA);
ProductDescriptionBuilder.BuildDescription(ProductB,ProductA);
}
}
My questions: what is a good design for this? Is the method proposed above acceptable? Do you see any potential problems with this design?
source
share