SlideShare a Scribd company logo
MVC pattern and
implementation in java
Agenda
•   Context
•   Problem
•   Solution
•   What is MVC?
•   MVC Architecture
•   Common MVC Implementation
•   MVC Interaction Order
•   MVC Pattern
•   MVC Responsibilities
•   Advantages of MVC
•   Implementation of MVC
CONTEXT


• Interactive applications with a flexible
  human-computer interface
PROBLEM DEFINITION
• User interfaces are especially prone to change
  requests.
• Different user place conflicting requirements on the
  user interface.
• Building a system with the required flexibility is
  expensive and error-prone if the user interface is
  tightly interwoven with the functional core.
PROBLEM DEFINITION
• The following forces influence the solution
   – The same information is presented differently in different
     windows, for example, in a bar or pie chart.
   – The display and behavior of the application must reflect
     data manipulations immediately.
   – Changes to the user interface should be easy, and even
     possible at run-time.
   – Support different ‘look and feel’ standards or porting the
     user interface should not affect code in the core of the
     application.
SOLUTION

MVC – Model View Controller
What is MVC?

• MVC - Model-View-Controller - is a design pattern
  for the architecture of web applications.
• It is a widely adopted pattern, across many languages
  and implementation frameworks, whose purpose is to
  achieve a clean separation between three components
  of most any web application.
MVC Architecture
• The Model represents the structure of the data in the
  application, as well as application-specific operations on
  those data.
• The View renders the contents of a model. It specifies
  exactly how the model data should be presented.
• The Controller translates user actions (mouse
  motions, keystrokes, words spoken, etc.) and user input
  into application function calls on the model, and selects
  the appropriate View based on user preferences and
  Model state.
Cond…
  The MVC architecture divides an application (code)
  required to manage a user interface into three parts:

• Data components maintain the raw application data
  and application logic for the interface –model.
• Presentation components provide the visual
  representation(s) of the data --view (usually to the
  screen).
• Input-processing components handle input from the
  user by modifying the model--controller.
Common MVC Implementation
MVC Actions
• Model
          -- Notify view about data updates
• View
         --Change rendering as needed
• Controller
         --Select view to be rendered based on
  event notifications and method invocations
MVC Interaction Order

1.    User performs action, controller is notified.
2.    Controller may request changes to model.
3.    Controller may tell view to update.
4.    Model may notify view if it has been modified.
5.    View may need to query model for current data.
6.    View updates display for user.
                                       6
              4              View
                      5
     Model                      3

                                       1
                  2
                          Controller
MVC Pattern – Model
• Contains application & its data

• Provide methods to access & update data

• Interface defines allowed interactions

• Fixed interface enable both model & GUIs to be easily pulled out and
  replaced

• Examples:-

   – Text documents

   – Spreadsheets

   – Web browser

   – Video games
MVC Pattern – View
 Provides visual representation of model.

 Multiple views can display model at same time.




 When model is updated, all its views are informed & given
  chance to update themselves.
MVC Pattern – Controller

• Users interact with the controller

• Interprets mouse movement, keystrokes, etc.

• Communicates those activities to the model

• Interaction with model indirectly causes view(s) to
  update
model responsibilities

• store data in properties

• implement application methods
  (e.g., ClockModel.setTime() or ClockModel.stop())

• provide methods to register/unregister views

• notify views of state changes
• view responsibilities

     • create interface

     • update interface when model changes

     • forward input to controller

• controller responsibilities

     • translate user input into changes in the model

     • if change is purely cosmetic, update view
Advantages of MVC

 Separating Model from View (that is, separating data
  representation from presentation).
    More robust
    Easier to maintain
    permits run-time selection of appropriate Views
     based on workflow, user preferences, or Model state.

 Separating Controller from Model (application behavior
  from data representation)
    allows configurable mapping of user actions on the
     Controller to application functions on the Model.
 Easy to add multiple data presentations for the same
  data.
     • Multi-view applications
        (overview+detail, brushing,…)
     • Different users
     • Different UI platforms (mobile, client-
        side, server-side,…)
     • Alternate designs
                                     GUI

               Model
                                     GUI

                Model
                                     GUI
Cond…
 Facilitates adding new types of data presentation as
  technology develops.
 Model and View components can vary independently
  enhancing maintainability ,extensibility, and
  testability.
 allows user interfaces (views) to be easily
  added, removed, or changed
 allows response to user input (controller) to be easily
  changed
COND…

 changes can happen dynamically at runtime
 promotes code reuse (e.g., one view might be used
  with different models)
 allows multiple developers to simultaneously
  update the interface, logic, or input of an
  application without affecting other source code.
Implementation of MVC
Mvc   pattern   and implementation   in   java fair

More Related Content

PPTX
Flux architecture
Boyan Mihaylov
 
PDF
Spring MVC
Aaron Schram
 
PDF
Presentation on Ember.js
Jyaasa Technologies
 
PPTX
Java Swing
Arkadeep Dey
 
PPTX
Jdbc ppt
sandeep54552
 
PPT
Mvc architecture
Surbhi Panhalkar
 
PDF
Java awt tutorial javatpoint
Ricardo Garcia
 
PPTX
Spring Boot Tutorial
Naphachara Rattanawilai
 
Flux architecture
Boyan Mihaylov
 
Spring MVC
Aaron Schram
 
Presentation on Ember.js
Jyaasa Technologies
 
Java Swing
Arkadeep Dey
 
Jdbc ppt
sandeep54552
 
Mvc architecture
Surbhi Panhalkar
 
Java awt tutorial javatpoint
Ricardo Garcia
 
Spring Boot Tutorial
Naphachara Rattanawilai
 

What's hot (20)

PPTX
Model view controller (mvc)
M Ahsan Khan
 
PDF
3. Java Script
Jalpesh Vasa
 
PPTX
MVC Framework
Ashton Feller
 
PPTX
MVVM ( Model View ViewModel )
Ahmed Emad
 
PPTX
Spring MVC
Emprovise
 
PDF
Asp.net state management
priya Nithya
 
PPTX
Spring boot Introduction
Jeevesh Pandey
 
PDF
Asp.net mvc basic introduction
Bhagath Gopinath
 
PPTX
MVVM with WPF
S V
 
PPTX
Login control .net
ShaishavShah8
 
PPTX
laravel.pptx
asif290119
 
PDF
Test-Driven Security
VMware Tanzu
 
PPTX
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
PDF
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
PPTX
Spring Web MVC
zeeshanhanif
 
PPT
Introduction to java beans
Hitesh Parmar
 
PPTX
Master page in Asp.net
RupinderjitKaur9
 
PPTX
Apache JMeter - A brief introduction
silenceIT Inc.
 
PPTX
Interfaces in java
Abishek Purushothaman
 
Model view controller (mvc)
M Ahsan Khan
 
3. Java Script
Jalpesh Vasa
 
MVC Framework
Ashton Feller
 
MVVM ( Model View ViewModel )
Ahmed Emad
 
Spring MVC
Emprovise
 
Asp.net state management
priya Nithya
 
Spring boot Introduction
Jeevesh Pandey
 
Asp.net mvc basic introduction
Bhagath Gopinath
 
MVVM with WPF
S V
 
Login control .net
ShaishavShah8
 
laravel.pptx
asif290119
 
Test-Driven Security
VMware Tanzu
 
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
Spring Web MVC
zeeshanhanif
 
Introduction to java beans
Hitesh Parmar
 
Master page in Asp.net
RupinderjitKaur9
 
Apache JMeter - A brief introduction
silenceIT Inc.
 
Interfaces in java
Abishek Purushothaman
 
Ad

Viewers also liked (20)

PDF
Spring Mvc
ifnu bima
 
PPTX
Produtividade na criação de websites com ASP.NET MVC
Waldyr Felix
 
PPT
Physical examination of cattle lecture 2
Dauda Iliyasu
 
PPT
MVC
akshin
 
PPT
Ado.net
Iblesoft
 
PPT
Parturition
Dauda Iliyasu
 
ODP
Spring Mvc,Java, Spring
ifnu bima
 
PPSX
ADO.NET
Farzad Wadia
 
PPT
For Beginers - ADO.Net
Snehal Harawande
 
PPT
Introduction to ADO.NET
rchakra
 
PPTX
ADO.NET -database connection
Anekwong Yoddumnern
 
ODP
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
PPSX
Seminar on java
shathika
 
PPT
ASP.NET MVC Presentation
ivpol
 
PPTX
Introduction to ASP.NET MVC
Khaled Musaied
 
PPT
Spring MVC Basics
Bozhidar Bozhanov
 
PPT
Core java slides
Abhilash Nair
 
PPT
Introduction to Cyber Security
Stephen Lahanas
 
PPTX
Database administrator
Tech_MX
 
PPTX
Symbol table design (Compiler Construction)
Tech_MX
 
Spring Mvc
ifnu bima
 
Produtividade na criação de websites com ASP.NET MVC
Waldyr Felix
 
Physical examination of cattle lecture 2
Dauda Iliyasu
 
MVC
akshin
 
Ado.net
Iblesoft
 
Parturition
Dauda Iliyasu
 
Spring Mvc,Java, Spring
ifnu bima
 
ADO.NET
Farzad Wadia
 
For Beginers - ADO.Net
Snehal Harawande
 
Introduction to ADO.NET
rchakra
 
ADO.NET -database connection
Anekwong Yoddumnern
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Seminar on java
shathika
 
ASP.NET MVC Presentation
ivpol
 
Introduction to ASP.NET MVC
Khaled Musaied
 
Spring MVC Basics
Bozhidar Bozhanov
 
Core java slides
Abhilash Nair
 
Introduction to Cyber Security
Stephen Lahanas
 
Database administrator
Tech_MX
 
Symbol table design (Compiler Construction)
Tech_MX
 
Ad

Similar to Mvc pattern and implementation in java fair (20)

PPTX
Architectural Design & Patterns
Inocentshuja Ahmad
 
ODP
Model View Controller
Madhukar Kumar
 
PDF
MVC - In Details
Mollah Nayeem Ahmed
 
PPT
Mvc 130330091359-phpapp01
Jennie Gajjar
 
PPT
Web engineering - MVC
Nosheen Qamar
 
PPTX
Model View Controller ext4
Pankaj Avhad
 
PDF
MVC Seminar Presantation
Abhishek Yadav
 
PPTX
MVC.pptx
HassanAliKhan36
 
PPTX
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
QuickwayInfoSystems3
 
PPTX
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
QuickwayInfoSystems3
 
PPTX
Interaction-Oriented Architecture.pptx
Godwin Monserate
 
PPSX
Software Design Patterns
alkuzaee
 
PPT
Ppt of Basic MVC Structure
Dipika Wadhvani
 
PDF
Models used in iOS programming, with a focus on MVVM
Andrei Popa
 
PPTX
Web tier-framework-mvc
KashfUlHuda1
 
PPT
J2 ee archi
saurabhshertukde
 
PDF
MVC Architecture
Prem Sanil
 
PPTX
Jsp with mvc
vamsitricks
 
Architectural Design & Patterns
Inocentshuja Ahmad
 
Model View Controller
Madhukar Kumar
 
MVC - In Details
Mollah Nayeem Ahmed
 
Mvc 130330091359-phpapp01
Jennie Gajjar
 
Web engineering - MVC
Nosheen Qamar
 
Model View Controller ext4
Pankaj Avhad
 
MVC Seminar Presantation
Abhishek Yadav
 
MVC.pptx
HassanAliKhan36
 
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
QuickwayInfoSystems3
 
What Are The Benefits Of Using MVC Framework In ASP.NET Development.pptx
QuickwayInfoSystems3
 
Interaction-Oriented Architecture.pptx
Godwin Monserate
 
Software Design Patterns
alkuzaee
 
Ppt of Basic MVC Structure
Dipika Wadhvani
 
Models used in iOS programming, with a focus on MVVM
Andrei Popa
 
Web tier-framework-mvc
KashfUlHuda1
 
J2 ee archi
saurabhshertukde
 
MVC Architecture
Prem Sanil
 
Jsp with mvc
vamsitricks
 

More from Tech_MX (20)

PPTX
Virtual base class
Tech_MX
 
PPTX
Uid
Tech_MX
 
PPTX
Theory of estimation
Tech_MX
 
PPTX
Templates in C++
Tech_MX
 
PPT
String & its application
Tech_MX
 
PPTX
Statistical quality__control_2
Tech_MX
 
PPTX
Stack data structure
Tech_MX
 
PPT
Stack Data Structure & It's Application
Tech_MX
 
PPTX
Spss
Tech_MX
 
PPTX
Spanning trees & applications
Tech_MX
 
PPTX
Set data structure 2
Tech_MX
 
PPTX
Set data structure
Tech_MX
 
PPTX
Real time Operating System
Tech_MX
 
PPTX
Parsing
Tech_MX
 
PPTX
Mouse interrupts (Assembly Language & C)
Tech_MX
 
PPT
Motherboard of a pc
Tech_MX
 
PPTX
More on Lex
Tech_MX
 
PPTX
MultiMedia dbms
Tech_MX
 
PPTX
Merging files (Data Structure)
Tech_MX
 
PPTX
Memory dbms
Tech_MX
 
Virtual base class
Tech_MX
 
Uid
Tech_MX
 
Theory of estimation
Tech_MX
 
Templates in C++
Tech_MX
 
String & its application
Tech_MX
 
Statistical quality__control_2
Tech_MX
 
Stack data structure
Tech_MX
 
Stack Data Structure & It's Application
Tech_MX
 
Spss
Tech_MX
 
Spanning trees & applications
Tech_MX
 
Set data structure 2
Tech_MX
 
Set data structure
Tech_MX
 
Real time Operating System
Tech_MX
 
Parsing
Tech_MX
 
Mouse interrupts (Assembly Language & C)
Tech_MX
 
Motherboard of a pc
Tech_MX
 
More on Lex
Tech_MX
 
MultiMedia dbms
Tech_MX
 
Merging files (Data Structure)
Tech_MX
 
Memory dbms
Tech_MX
 

Recently uploaded (20)

PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
Architecture of the Future (09152021)
EdwardMeyman
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPT
Coupa-Kickoff-Meeting-Template presentai
annapureddyn
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PPTX
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
Architecture of the Future (09152021)
EdwardMeyman
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Coupa-Kickoff-Meeting-Template presentai
annapureddyn
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
This slide provides an overview Technology
mineshkharadi333
 
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Software Development Methodologies in 2025
KodekX
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 

Mvc pattern and implementation in java fair

  • 2. Agenda • Context • Problem • Solution • What is MVC? • MVC Architecture • Common MVC Implementation • MVC Interaction Order • MVC Pattern • MVC Responsibilities • Advantages of MVC • Implementation of MVC
  • 3. CONTEXT • Interactive applications with a flexible human-computer interface
  • 4. PROBLEM DEFINITION • User interfaces are especially prone to change requests. • Different user place conflicting requirements on the user interface. • Building a system with the required flexibility is expensive and error-prone if the user interface is tightly interwoven with the functional core.
  • 5. PROBLEM DEFINITION • The following forces influence the solution – The same information is presented differently in different windows, for example, in a bar or pie chart. – The display and behavior of the application must reflect data manipulations immediately. – Changes to the user interface should be easy, and even possible at run-time. – Support different ‘look and feel’ standards or porting the user interface should not affect code in the core of the application.
  • 6. SOLUTION MVC – Model View Controller
  • 7. What is MVC? • MVC - Model-View-Controller - is a design pattern for the architecture of web applications. • It is a widely adopted pattern, across many languages and implementation frameworks, whose purpose is to achieve a clean separation between three components of most any web application.
  • 8. MVC Architecture • The Model represents the structure of the data in the application, as well as application-specific operations on those data. • The View renders the contents of a model. It specifies exactly how the model data should be presented. • The Controller translates user actions (mouse motions, keystrokes, words spoken, etc.) and user input into application function calls on the model, and selects the appropriate View based on user preferences and Model state.
  • 9. Cond… The MVC architecture divides an application (code) required to manage a user interface into three parts: • Data components maintain the raw application data and application logic for the interface –model. • Presentation components provide the visual representation(s) of the data --view (usually to the screen). • Input-processing components handle input from the user by modifying the model--controller.
  • 11. MVC Actions • Model -- Notify view about data updates • View --Change rendering as needed • Controller --Select view to be rendered based on event notifications and method invocations
  • 12. MVC Interaction Order 1. User performs action, controller is notified. 2. Controller may request changes to model. 3. Controller may tell view to update. 4. Model may notify view if it has been modified. 5. View may need to query model for current data. 6. View updates display for user. 6 4 View 5 Model 3 1 2 Controller
  • 13. MVC Pattern – Model • Contains application & its data • Provide methods to access & update data • Interface defines allowed interactions • Fixed interface enable both model & GUIs to be easily pulled out and replaced • Examples:- – Text documents – Spreadsheets – Web browser – Video games
  • 14. MVC Pattern – View  Provides visual representation of model.  Multiple views can display model at same time.  When model is updated, all its views are informed & given chance to update themselves.
  • 15. MVC Pattern – Controller • Users interact with the controller • Interprets mouse movement, keystrokes, etc. • Communicates those activities to the model • Interaction with model indirectly causes view(s) to update
  • 16. model responsibilities • store data in properties • implement application methods (e.g., ClockModel.setTime() or ClockModel.stop()) • provide methods to register/unregister views • notify views of state changes
  • 17. • view responsibilities • create interface • update interface when model changes • forward input to controller • controller responsibilities • translate user input into changes in the model • if change is purely cosmetic, update view
  • 18. Advantages of MVC  Separating Model from View (that is, separating data representation from presentation).  More robust  Easier to maintain  permits run-time selection of appropriate Views based on workflow, user preferences, or Model state.  Separating Controller from Model (application behavior from data representation)  allows configurable mapping of user actions on the Controller to application functions on the Model.
  • 19.  Easy to add multiple data presentations for the same data. • Multi-view applications (overview+detail, brushing,…) • Different users • Different UI platforms (mobile, client- side, server-side,…) • Alternate designs GUI Model GUI Model GUI
  • 20. Cond…  Facilitates adding new types of data presentation as technology develops.  Model and View components can vary independently enhancing maintainability ,extensibility, and testability.  allows user interfaces (views) to be easily added, removed, or changed  allows response to user input (controller) to be easily changed
  • 21. COND…  changes can happen dynamically at runtime  promotes code reuse (e.g., one view might be used with different models)  allows multiple developers to simultaneously update the interface, logic, or input of an application without affecting other source code.