Why do we use DTO and DAO, and when should we use them. I am developing a GUI Java software to do with inserting, editing, deleting data. But I am struggling to distinguish between DTO/DAO and Model, View, Controller (MVC) structure? Are they similar, which is better to use when interacting with database through Java GUI.
One thing I'm really curious about is whether it is a good practice to have View and Controller in one class. If we think about NetBeans, you can create GUI
Frame
class and add components likeJButton
onto the frame, double clicking the button will take you to theactionListener
method (Controller) which appears to be in the frame the data is to be displayed to the user (View). So they're in the same class. Is that completely going against the concept then or not?
Here is what I'm talking about
Is it bad practice to have view and controller in one class?