pcr)
Accelerate Your
Career with UsGrad
ARCHITECTURE
» INJAVA
A Beginner’s Guide to MVC Architecture
in Java
you're related to web development scene, you'll most certainly have come across the
acronyin “MVe” hundreds of time, snot more, MVC sone ofthe most talked about design
pattems inthe web programming world today, and rightly so. In this article, wel take you
through the wold of MVC Architecture, Well talleabout the bases of MVC, its advantages, andTro nthe)
Mediator
Accelerate Your
Controller Career with UsGrad
Fopsiy Component ———
Foes Upsate
Model _| [_ View _
Propery eer
change ‘Action Prone
Seem “ava Suing
What exactly is the MVC architecture?
Before we get nto the technicalities oft, let's make some things clear ~ MVC is NOT a design
‘patter, it'sa way to structure your applications. in recent years, che web applications are
certensively using the MVC architecture, and hence t's natural to confuse ifr a design pater
«exclusive fr web applications. However, lets tll you thac MVC was fest eserbed way back in
1979 ~ before the’
Recent Posts
:W erawhen there was no concept of wed applications. The architecture onus ina nein
used today for web applications isan adaptation of the ociginal pattern
infact, this architecture wa iniialy included nthe two major web development frameworks
~ struts and Ruby on Rall, These tw environments paved the way fora majority of web
frameworks that came later ~ and thus the popularity ofthis architecture kept rising.Te Ie!
[MVC architectural pattern follows an elementary ides ~ we must separate the responses
Inany application onthe follwing bast:
+ Model: Handles data and business loge.
+ View: Presents the dota tothe wer whenever asked fr,
+ Controller: Entertains user requests and fetch necessary resources.
Each of the components has a demarcated set of tasks which ensures smooth foneioning of
the entice application along with complete modularity, Let us have look a each of these
components in farther deta
Controller
‘he controler s the lke the housekeeper of she aplication ~ it performs coordination
‘between model and view to entertain a user request, The user requests are received as HTTP get
or post request ~ for example, when the user clicks on any GUI elements to perform any action,
‘the primary function ofa controler iso call and coordinate withthe mode! to fetch any
necessary resources required to act Usually, on receiving a user request, the controller alls
the appropriate model forthe taskat hand,
Model
‘he models quite simply the data for our application The datas “modelled” in away it's easy
to store, retrieve, and edit The models how we aply rules to our data, which eventually
represents the concepts our application manages.
Accelerate Your
Career with UsGrad