MVC in Java

MVC is a software architecture pattern, which separates the details of information from user?s interaction with it. It has three components: Model, View and Controller. In this chapter you will learn about MVC in brief and how to implemented in Java through swing.

MVC in Java

MVC in Java

Before understanding the use of MVC in Java, let's understand what is MVC?

Abbreviated as MVC, Model-View-Controller is a term used for describing a software paradigm that separates objects into one of three categories - Model, view and control. Here Model works for maintaining data, view is used for displaying all or a portion of the data and controller works for handling events that affect the model or views.

In other words, we can say that MVC is the name of a methodology or design pattern used for connecting user interface to primary data models. MVC is used in Object-Oriented Programming development.

Moreover, we can also say that MVC is a software architecture pattern that detaches the depiction of information from the user's interaction with it. The MVC model comprises of application data, business rules, logic, and functions. A view can be any output representation of data, such as a chart or a diagram.

Model-View-Controller pattern is most commonly used in object oriented programming language such as Java. MVC has three main components:

Model: represents the underlying, logical structure of data in a software application and the high-level class associated with it. This object model does not contain any information about the user interface.

View: a set of classes representing the elements in the user interface (all of the things the user can see and respond to on the screen, such as buttons, display boxes, and so forth)

Controller: works to communicate between classes in the model and view.

MVC can be implemented in Java through Swing.