Question from the Patterns & Anti-patterns test

How to fix the "constructor hell" anti-pattern in Java?

Medium

Consider this Java class "Product":

public class Product {
    private String name;
    private String description;
    private String category;
    private String brand;
    private double price;
    private int stock;
    private String color;
    private String size;
    private String material;
    private String manufacturer;

    public Product(String name, String description, String category, String brand, double price, int stock, String color, String size, String material, String manufacturer) {
        this.name = name;
        this.description = description;
        this.category = category;
        this.brand = brand;
        this.price = price;
        this.stock = stock;
        this.color = color;
        this.size = size;
        this.material = material;
        this.manufacturer = manufacturer;
    }
}

Which of the following solutions, would be the most appropriate to fix this class anti-pattern?

Author: Fritzgy LubinStatus: PublishedQuestion not yet passed
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!