Skip to content

Create Simple MVC Pattern in Java

Hallo nice to meet you 😀

little bit “intermezzo” about MVC,

mvc model

As we are know in the last decade, the existence of MCV has been like a celebrity in the software engineering world.

The MVC pattern is the powerful rules that can be used for building a complex applications system. In the MVC we could separating process into the several layers. So many framework in many programming languages has implemented MVC pattern, even more in PHP.

In the MVC pattern there are three basic layers called (M for model, V for view, and C for controller). On the model layer usually we can put everything which having relations with data processing (database). Second, on the Controller we can put all of the logics for processing data that we can take from the models. And then the View can be used to displaying the data to the interface (as an information for users). For more detail you can read at this.

I will explain a simple example to implement MVC pattern, and at this moment I pick java to do that.

Oke, first we start with the M (Model)

Create a java class called ModelPeople :

Second thing, let’s create class for V (View) called ViewPeople :

And then create class for C (controller) called ControllerPeople :

And last let’s create a main class as bootstrap application called SimpleMvcPattern :

At the finall steps, let’s compile and run SimpleMvcPattern class.the result

Oke, finish ^_^

 

It's only fair to share...Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn2
Published inJavaProgrammingTips and Trik

One Comment

  1. andi J andi J

    Nice, simple 😀

Leave a Reply

Your email address will not be published. Required fields are marked *


6 − one =