I have a GUI that contains a Table Object (for displaying columns of data) and a Table Model. The Table Object contains the Table Model.
Is it better to store the Table Model as a object in the User interface or de-reference it as needed? Is there any performance gain keeping it separate? If there is, is it a good design to implement this?
For example:
public GUI {
private Table table;
private TableModel model;
public UI() {
this.table = new Table();
this.model = table.getModel();
}
public void actionPerformed() {
// Performance improvement
// without having to de-reference it from table
model.setRowLimit();
}
// OR
public void actionPerformed() {
// Slower but is it better OO Design
table.getModel().setRowLimit();
}
}
The GUI has 10 public methods exposed where the model could be updated or changed.