MVC Architecture In Java

This section will describe you all the aspects of MVC architecture such as what is design pattern, what is design model, types of designing model, what is MVC architecture, what is model, what is view, what is controller, advantages of MVC architecture.

MVC Architecture In Java

MVC Architecture In Java

In this section we will discuss about the MVC architecture.

This section will describe you all the aspects of MVC architecture such as what is design pattern, what is design model, types of designing model, what is MVC architecture, what is model, what is view, what is controller, advantages of MVC architecture.

What is Design Pattern ?

Design Pattern, in software engineering, is a technique to solve a commonly occurring problem in the specified context in software design. Design pattern describes that how a problem should be solved. In Object-Oriented it shows how the classes or objects are interacting as well as it also shows the relationships. It does not specifies the classes or objects involved in the final application. The concept of design pattern has come from the Gang Of Four (GOF) book "Design Patterns - Elements of Reusable Object-Oriented Software" from Erich Gamma, Richard Helm, Ralph Johnson und John Vlissides. Design pattern has various types such as : Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns, Behavioral design patterns.

What is designing model ?

Designing model specifies that how you design your model. In the context of programming language, we can say that what type of architecture you uses to solve your problem or design the model.

Types Of Designing Model

In context programming language, when we talk about developing web applications, designing model has two types :

  • Model 1 Architecture : Applications are developed without using design pattern.
  • Model 2 (MVC) Architecture : Applications are developed using MVC (Model-View-Controller) design pattern.

What is MVC Architecture ?

Models designs on MVC architecture follows the MVC design pattern. MVC, a software architecture pattern, is mostly used in the enterprise applications. MVC as the name is divided into three parts namely Model, View, and Controller. MVC design pattern is used for designing models because it separates the representation information from the users. In the MVC design pattern application data, business logic and functions are kept into model, view consists the output representation, and the controller handles request coming from the view or user interface, controls the data data flow in the application, forwards the request to the corresponding handler, responsible for using models and rendering it into various UIs.

What is Model ?

In the MVC design pattern, Model, represents the data, business logic and functions. It provides the persistent storage of that the controller can manipulate.

What is View ?

In the MVC design pattern, View, represents the output or the user interface. Input can be taken through the view.

What is Controller ?

In the MVC design pattern, Controller, controls the request coming from the view, it can forward the request to the corresponding handler to change the view's representation of associated view. it can also forward the request to the model to update the state of model.

Advantages of MVC architecture

There are various advantages of MVC architecture that a programmer should adopt it for developing applications. These are as :

  • Reusability of code : Main advantage of MVC model is the reusability of code.
  • Expressiveness : Adoption of MVC model makes the application more expressive.
  • Maintainable : Applications based on MVC architecture are easy to maintain.

Except the advantages discussed above there are some more advantages of MVC architecture. These are as :

  • Using the MVC architecture we can make our application loosely coupled. We can less the interdependencies upon codes.
  • Testing becomes easy.
  • Control of application controlled by the controller.