Design To Handle Multiple Similar Model Class I am doing a web app for an event company whereby customer can access the website for a self-help instant quotation. Customer will choose the type of event, fill a form and expect an instant quotation.

Can anyone give me some tips how can I improve my design? Below are my current design thoughts.

Quotation class:

public class Quotation{

    // Customer specific details
    private String customerName;
    private String customerEmail;
    private String customerMobile;

    // Event specific details
    private WeddingEvent weddingEvent;
    private RetreatEvent retreatEvent;
    // ... another 4 or 5 more event classes

    // getters and setters
    // ...
}


Event Classes:

public class BaseEvent{
    private int attendance;
    private String venue;
}

public class WeddingEvent extends BaseEvent{
    private boolean needWeddingPlanner;
    // getters and setters
    // ...
}

public class RetreatEvent extends BaseEvent{
    private boolean needBreakfast;
    private boolean needLunch;
    private boolean needDinner;

    // getters and setters
    // ...
}
I would suggest the following potential improvements.

Change the Quotation class to the following

public class Quotation
{
    private Customer customer;

    private List&lt;BaseEvent&gt; events = new List&lt;BaseEvent&gt;();


    // Getters and setters to access the two entities above.
}


So now you have divided you elements into specific entities like Quotation, Customer and Events.

Adding more details to a Customer or adding a new Event type, don't require change to the Quotation class, but only changes to the specific entity.

On the side, you might also find it beneficial to look into a simple visitor pattern for the events and provide algorithms to etc. calculate total price, date collisions, number of participants etc. etc.

Enjoy.