Model, View, Controller
A Great Design Pattern
When I was learning to program, I learned to separate my classes. Intuitively, it made sense to isolate the logic side of code from the display side of it. This is the classic backend/frontend structure used by most apps. However, when I learned about the MVC design pattern, I began to understand how much separation was truly needed to make code as maintainable as possible.
The MVC structure is as such:
- (M)odel: Contains core code logic
- (V)iew: Contains anything the user will view (CLI/GUI)
- (C)ontroller: Controls the behavior of the model and view
In MVC, the model and view are kept completely isolated from each other. Each package does not know the other exists.
For an example of MVC applied to a Java swing app, download this project file.