SlideShare a Scribd company logo
MVC Design Pattern
June 2015
Design Patterns
• A pattern is a proven solution to a problem in a context.
• Christopher Alexander says each pattern is a three-part rule which
expresses a relation between a certain context, a problem, and a
solution.
• Design patterns represent a solutions to problems that arise when
developing software within a particular context.
i.e Patterns = problems.solution pairs in a context
Background
• Started in 1987 by Ward Cunningham and Ken Beck who were
working with Smalltalk and designing GUIs.
• Popularized by Gamma, Helm, Johnson and Vlissides (The
gang of four, Go4)
• The three of Go4 were working on frameworks (E++,Unidraw,
HotDraw)
• Design pattern use a consistent documentation approach
• Design pattern are granular and applied at different levels
such as frameworks, subsystems and sub-subsystems
• Design patterns are often organized as creational, structural or
behavioral
Categorizing Pattern
Patterns, then, represent expert solutions to
recurring problems in a context and thus have
been captured at many levels of abstraction
and in numerous domains. Numerous
categories are:
• Design
• Architectural
• Analysis
• Creational
• Structural
• Behavioral
Sun’s J2EE Framework
• Components Containers and Connectors:
Hiding Complexity, Enhancing Portability
• Components are the key focus of application
developers
• Containers intercede between clients and
components, providing services
transparently to both, including transaction
support and resource pooling.
• Connectors sit beneath the J2EE platform,
defining a portable service API to plug into
existing enterprise vendor offerings.
J2EE
• Components
▫ Enterprise Java Beans (EJB)
▫ Java Server Pages (JSP)
▫ Servlets
• Containers (service providers)
▫ Web container
▫ Bean Container
• Connectors (connection service providers)
Mcv design patterns
J2EE and Design Patterns
• J2EE: AN OPERATING SYSTEM FOR THE WEB Enterprise
web applications, which live on networks and are
accessible through browsers, are redefining Enterprise
Web Software. This is the next wave of computing.
• The J2EE architecture is built to enable
component developers to use a Model View
Controller (MVC) Design Pattern.
Details of MVC Design Pattern
• Name (essence of the pattern)
▫ Model View Controller MVC
• Context (where does this problem occur)
▫ MVC is an architectural pattern that is used when
developing interactive application such as a shopping
cart on the Internet.
• Problem (definition of the reoccurring difficulty)
▫ User interfaces change often, especially on the internet
where look-and-feel is a competitive issue. Also, the
same information is presented in different ways. The
core business logic and data is stable.
MVC continued
• Solution (how do you solve the problem)
▫ Use the software engineering principle of “separation of concerns” to
divide the application into three areas:
 Model encapsulates the core data and functionality
 View encapsulates the presentation of the data there
can be many views of the common data
 Controller accepts input from the user and makes
request from the model for the data to produce a new
view.
MVC Structure for J2EE
MVC Architecture
• The Model represents the structure of the data in the application,
as well as application-specific operations on those data.
• A View (of which there may be many) presents data in some form
to a user, in the context of some application function.
• A 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.
Example of MVC Design Pattern
• Let’s investigate this statement by looking at a
small application that demonstrates MVC on
J2EE
Java Pet Store- MVC Design Pattern
 The Java Pet Store is a reference application that
demonstrates J2EE technologies.
 It demonstrates interaction between Java Server Pages
(JSP's), custom Tag Libraries, JavaBeans, and Enterprise
Java Beans.
 It demonstrates a real-world approach to application
development, where the presentation of data is separated
from the process of obtaining data from objects which
interact with the enterprise or database tier.
 The Pet Store application implements MVC (Model-View-
Controller) design, and demonstrates one way to design an
application that should scale well.
Multi Tier Architecture
 The Java Pet Store design is divided into multiple tiers:
A. Client tier
B. Web tier
C. Enterprise JavaBeans tier
D. Enterprise Information System tier.
 These tiers are not necessarily arranged hierarchically.
 Each tier may communicate directly with other tiers, or indirectly by
way of intermediate tiers.
J2EE Architecture Tiers
A. Details of Client Tier
• The Client tier is responsible for presenting data to the user,
interacting with the user, and communicating with the other tiers of
the application.
• The Client tier is the only part the application the user ever sees.
• The Client tier communicates with other tiers by way of well-defined
interfaces.
• A separate Client tier in the design provides flexibility and
extensibility.
A. Details of Client Tier
• In The Java Pet Store Client tier consists mainly of a browser displaying
Web pages generated from server-side JSP pages in the Web tier.
• Future new clients can be written using technologies or languages that do
not yet even exist, since they must conform only to the interface for
communicating with other tiers
B. Web Tier
• The Web tier is responsible for performing all Web-related
processing, such as serving HTML, instantiating Web page
templates, and formatting JSP pages for display by browsers.
• The Web tier in the Java Pet Store does all of these, and takes on the
Controller functions for the Web application, caching model data
interpreting user inputs, selecting appropriate Views based on
application flow, and managing database connections.
C. EJB Tier
• Enterprise JavaBeans are software business components which
extend servers to perform application-specific functionality.
• The interface between these components and their containers is
defined in the EJBs specification.
• Essentially, the EJBs tier provides a component model for access to
distributed system services and persistent data.
C. EJB Tier
• Both stand-alone clients and Web applications in the Web tier can
use EJB components hosted by the EJBs tier.
• It also simplifies application component development, because
details about system issues such as persistence, reentrancy,
transactions, remote access, and so on, are all handled by the
container.
D.Enterprise Information System
(EIS) Tier
• The EIS tier is the enterprise information infrastructure.
• Members of the EIS tier typically include enterprise information planning
(ERP) systems, transaction processing monitors, relational database
management systems, and legacy enterprise applications.
• Access to the EIS tier is usually transactional, to ensure that data are
consistent across application boundaries.
• The EIS tier also enforces security and offers scalability.
MVC supports Modular Design
 Has set of modules, each tightly coupled internally, and
loosely coupled between modules.
 Each module has an interface that defines the module's
functional requirements and provides a place where third-
party products may be integrated.
 The Java Pet Store demo modules are:
 User Account
 Product Catalog
 Order Processing
 Messaging
 Inventory
 Control
 The Modular design supports the design goal of reusable
software.
Java Pet store- MVC
• Views
▫ JSP pages, composed with templates and
displayed in an HTML browser
• Controller
▫ maps user input from the browser to request
events, and forwards those events to the Shopping
Client Controller in the EJB tier.
• Model
▫ EJB Tier
MVC Details in Java Pet store
• Model represents the structure of the data in the application, as well as
application-specific operations on data
- CartModel, InventoryModel, CustomerEJB, and others
• Views are Java server pages (JSPs)
▫ rendered from the web container to the browser, stand-alone
applications that provide View functionality, and interfaces to
spreadsheet programs, such as the StarOfficeTM suite.
• Controller is server side java program (Servlet)
▫ MainServlet.java, which dispatches browser requests to other
controller objects, such as ShoppingClientController.java,
AdminClientController.java, and their related support classes.
Views:Java Server Page (JSP)
• http://java.sun.com/products/jsp/
• Technology for developing dynamic web sites
that replaces CGI
• Thought of as a server-side scripting tool
• Contains HTML and Java code (scripts)
• Is compiled into a servlet and executes on the
server.
Controller Servlet
• A java class that runs on the server
• Extends http Servlet
• Runs in a container class
(servlet/JSP engine)
• Application servers (Jrun, WebLogic) have the
containers
• This has the logic for the application
EJBs
• Enterprise Java Beans Connect Servlets to the
back end database
• Examples of EJBs in Java Pet store are:
AccountHandler, ModelUpdateManager,
ShoppingClientControllerHome, CartHandler,
ShoppingClientControllerEJB, SigninHandler,
OrderHandler
Advantages of MVC
• Separating Model from View (that is, separating
data representation from presentation)
- easy to add multiple data presentations for
the same data,
-facilitates adding new types of data
presentation as technology develops.
-Model and View components can vary
independently enhancing maintainability,
extensibility, and testability.
Advantages of MVC design Pattern
• Separating Controller from View (application behavior from
presentation)
- 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.
Consequences or Benefits
• We make changes without bringing down the
server.
• We leave the core code alone
• We can have multiple versions of the same data
displayed
• We can test our changes in the actual
environment.
• We have achieved “separation of concerns”
References
• Home of the patterns community
http://hillside.net/
• Adaptability home page
▫ http://www.utdallas.edu/~chung/adaptability.html
• Quickest road to understanding the concepts
non-software examples
▫ http://www.agcs.com/supportv2/techpapers/patterns/papers/tutnotes/
index.htm
• The Sun location for J2ee
▫ http://java.sun.com/j2ee/
• Sun’s Java Pet store example used
▫ http://jboss.utdallas.edu:8080/estore
Ad

More Related Content

What's hot (20)

Modern Software Architectures: Building Solutions for Web, Cloud, and Mobile
Modern Software Architectures: Building Solutions for Web, Cloud, and MobileModern Software Architectures: Building Solutions for Web, Cloud, and Mobile
Modern Software Architectures: Building Solutions for Web, Cloud, and Mobile
Dan Mohl
 
Greate Introduction to Oracle Fusion Middleware and ADF
Greate Introduction to Oracle Fusion Middleware and ADFGreate Introduction to Oracle Fusion Middleware and ADF
Greate Introduction to Oracle Fusion Middleware and ADF
Mohamed Shahpoup
 
Dynamic Object-Oriented Requirements System (DOORS)
Dynamic Object-Oriented Requirements System (DOORS)Dynamic Object-Oriented Requirements System (DOORS)
Dynamic Object-Oriented Requirements System (DOORS)
David Groff
 
Basic concepts and terminology for the Requirements Management application
Basic concepts and terminology for the Requirements Management applicationBasic concepts and terminology for the Requirements Management application
Basic concepts and terminology for the Requirements Management application
IBM Rational software
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfolio
cummings49
 
Ch4 ejb
Ch4 ejbCh4 ejb
Ch4 ejb
Raghavendra Goud
 
Prashant Patel
Prashant PatelPrashant Patel
Prashant Patel
Prashant Patel
 
An Oracle ADF Introduction
An Oracle ADF IntroductionAn Oracle ADF Introduction
An Oracle ADF Introduction
Jean-Marc Desvaux
 
Doors hints and tips schema
Doors hints and tips schemaDoors hints and tips schema
Doors hints and tips schema
Hazel Woodcock
 
Establishing and analyzing traceability between artifacts
Establishing and analyzing traceability between artifactsEstablishing and analyzing traceability between artifacts
Establishing and analyzing traceability between artifacts
IBM Rational software
 
J2ee web services(overview)
J2ee web services(overview)J2ee web services(overview)
J2ee web services(overview)
Prafull Jain
 
Ejb course-in-mumbai
Ejb course-in-mumbaiEjb course-in-mumbai
Ejb course-in-mumbai
vibrantuser
 
Modules as requirement specifications
Modules as requirement specificationsModules as requirement specifications
Modules as requirement specifications
IBM Rational software
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
Middleware Training
 
Managing requirements by using baselines
Managing requirements by using baselinesManaging requirements by using baselines
Managing requirements by using baselines
IBM Rational software
 
MVC
MVCMVC
MVC
Iman Mehmandoust
 
7) packaging and deployment
7) packaging and deployment7) packaging and deployment
7) packaging and deployment
techbed
 
Architecture of eSobi club based on J2EE
Architecture of eSobi club based on J2EEArchitecture of eSobi club based on J2EE
Architecture of eSobi club based on J2EE
Allan Huang
 
J2 EEE SIDES
J2 EEE  SIDESJ2 EEE  SIDES
J2 EEE SIDES
bputhal
 
Identifying and managing change
Identifying and managing changeIdentifying and managing change
Identifying and managing change
IBM Rational software
 
Modern Software Architectures: Building Solutions for Web, Cloud, and Mobile
Modern Software Architectures: Building Solutions for Web, Cloud, and MobileModern Software Architectures: Building Solutions for Web, Cloud, and Mobile
Modern Software Architectures: Building Solutions for Web, Cloud, and Mobile
Dan Mohl
 
Greate Introduction to Oracle Fusion Middleware and ADF
Greate Introduction to Oracle Fusion Middleware and ADFGreate Introduction to Oracle Fusion Middleware and ADF
Greate Introduction to Oracle Fusion Middleware and ADF
Mohamed Shahpoup
 
Dynamic Object-Oriented Requirements System (DOORS)
Dynamic Object-Oriented Requirements System (DOORS)Dynamic Object-Oriented Requirements System (DOORS)
Dynamic Object-Oriented Requirements System (DOORS)
David Groff
 
Basic concepts and terminology for the Requirements Management application
Basic concepts and terminology for the Requirements Management applicationBasic concepts and terminology for the Requirements Management application
Basic concepts and terminology for the Requirements Management application
IBM Rational software
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfolio
cummings49
 
Doors hints and tips schema
Doors hints and tips schemaDoors hints and tips schema
Doors hints and tips schema
Hazel Woodcock
 
Establishing and analyzing traceability between artifacts
Establishing and analyzing traceability between artifactsEstablishing and analyzing traceability between artifacts
Establishing and analyzing traceability between artifacts
IBM Rational software
 
J2ee web services(overview)
J2ee web services(overview)J2ee web services(overview)
J2ee web services(overview)
Prafull Jain
 
Ejb course-in-mumbai
Ejb course-in-mumbaiEjb course-in-mumbai
Ejb course-in-mumbai
vibrantuser
 
Modules as requirement specifications
Modules as requirement specificationsModules as requirement specifications
Modules as requirement specifications
IBM Rational software
 
Managing requirements by using baselines
Managing requirements by using baselinesManaging requirements by using baselines
Managing requirements by using baselines
IBM Rational software
 
7) packaging and deployment
7) packaging and deployment7) packaging and deployment
7) packaging and deployment
techbed
 
Architecture of eSobi club based on J2EE
Architecture of eSobi club based on J2EEArchitecture of eSobi club based on J2EE
Architecture of eSobi club based on J2EE
Allan Huang
 
J2 EEE SIDES
J2 EEE  SIDESJ2 EEE  SIDES
J2 EEE SIDES
bputhal
 

Viewers also liked (20)

Cognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational InterfacesCognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational Interfaces
Pavel Veller
 
FVCP - Facebook , Twitter and Meetup API / Widgets
FVCP - Facebook , Twitter and Meetup API / WidgetsFVCP - Facebook , Twitter and Meetup API / Widgets
FVCP - Facebook , Twitter and Meetup API / Widgets
Pete DuMelle
 
1072個研發替代役的日子
1072個研發替代役的日子1072個研發替代役的日子
1072個研發替代役的日子
Mu Chun Wang
 
Social networking api for Android Developers
Social networking api for Android DevelopersSocial networking api for Android Developers
Social networking api for Android Developers
Satyam Twanabasu
 
đau Nhức Khớp Cổ Chân
đau Nhức Khớp Cổ Chânđau Nhức Khớp Cổ Chân
đau Nhức Khớp Cổ Chân
becki138
 
Unidad1act2audioeducativo 120227190047-phpapp01
Unidad1act2audioeducativo 120227190047-phpapp01Unidad1act2audioeducativo 120227190047-phpapp01
Unidad1act2audioeducativo 120227190047-phpapp01
UNIVERSIDAD DE LAS AMÉRICAS ECUADOR
 
APM
APMAPM
APM
Annelpm
 
Presentacion Weblog FEDITIC
Presentacion Weblog FEDITICPresentacion Weblog FEDITIC
Presentacion Weblog FEDITIC
Katiusca Peña
 
TD_Portfolio_2015-lrz
TD_Portfolio_2015-lrzTD_Portfolio_2015-lrz
TD_Portfolio_2015-lrz
Steve Albert
 
√ Website designing company in delhi
√ Website designing company in delhi√ Website designing company in delhi
√ Website designing company in delhi
Css Founder
 
Website designing company in gurgaon
Website designing company in gurgaonWebsite designing company in gurgaon
Website designing company in gurgaon
Css Founder
 
Website development company in delhi ncr
Website development company in delhi ncrWebsite development company in delhi ncr
Website development company in delhi ncr
Css Founder
 
Урок "ЧОРНОБИЛЬСЬКА КАТАСТРОФА"
Урок  "ЧОРНОБИЛЬСЬКА КАТАСТРОФА"Урок  "ЧОРНОБИЛЬСЬКА КАТАСТРОФА"
Урок "ЧОРНОБИЛЬСЬКА КАТАСТРОФА"
Школа №7 Миргород
 
Website designing company in faridabad
Website designing company in faridabadWebsite designing company in faridabad
Website designing company in faridabad
Css Founder
 
Бібліотека та технології веб-2.0
Бібліотека та технології веб-2.0Бібліотека та технології веб-2.0
Бібліотека та технології веб-2.0
Школа №7 Миргород
 
Live streaming
Live streamingLive streaming
Live streaming
trs4
 
URP 486 LandUseProject (Final)
URP 486 LandUseProject (Final)URP 486 LandUseProject (Final)
URP 486 LandUseProject (Final)
Alonzo Lopez
 
The Chat Revolution
The Chat RevolutionThe Chat Revolution
The Chat Revolution
trs4
 
Why you should live stream your next major meeting
Why you should live stream your next major meeting Why you should live stream your next major meeting
Why you should live stream your next major meeting
Jim McConnell
 
20161024 R語言資料分析實務 (3)
20161024 R語言資料分析實務 (3)20161024 R語言資料分析實務 (3)
20161024 R語言資料分析實務 (3)
羅左欣
 
Cognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational InterfacesCognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational Interfaces
Pavel Veller
 
FVCP - Facebook , Twitter and Meetup API / Widgets
FVCP - Facebook , Twitter and Meetup API / WidgetsFVCP - Facebook , Twitter and Meetup API / Widgets
FVCP - Facebook , Twitter and Meetup API / Widgets
Pete DuMelle
 
1072個研發替代役的日子
1072個研發替代役的日子1072個研發替代役的日子
1072個研發替代役的日子
Mu Chun Wang
 
Social networking api for Android Developers
Social networking api for Android DevelopersSocial networking api for Android Developers
Social networking api for Android Developers
Satyam Twanabasu
 
đau Nhức Khớp Cổ Chân
đau Nhức Khớp Cổ Chânđau Nhức Khớp Cổ Chân
đau Nhức Khớp Cổ Chân
becki138
 
Presentacion Weblog FEDITIC
Presentacion Weblog FEDITICPresentacion Weblog FEDITIC
Presentacion Weblog FEDITIC
Katiusca Peña
 
TD_Portfolio_2015-lrz
TD_Portfolio_2015-lrzTD_Portfolio_2015-lrz
TD_Portfolio_2015-lrz
Steve Albert
 
√ Website designing company in delhi
√ Website designing company in delhi√ Website designing company in delhi
√ Website designing company in delhi
Css Founder
 
Website designing company in gurgaon
Website designing company in gurgaonWebsite designing company in gurgaon
Website designing company in gurgaon
Css Founder
 
Website development company in delhi ncr
Website development company in delhi ncrWebsite development company in delhi ncr
Website development company in delhi ncr
Css Founder
 
Урок "ЧОРНОБИЛЬСЬКА КАТАСТРОФА"
Урок  "ЧОРНОБИЛЬСЬКА КАТАСТРОФА"Урок  "ЧОРНОБИЛЬСЬКА КАТАСТРОФА"
Урок "ЧОРНОБИЛЬСЬКА КАТАСТРОФА"
Школа №7 Миргород
 
Website designing company in faridabad
Website designing company in faridabadWebsite designing company in faridabad
Website designing company in faridabad
Css Founder
 
Live streaming
Live streamingLive streaming
Live streaming
trs4
 
URP 486 LandUseProject (Final)
URP 486 LandUseProject (Final)URP 486 LandUseProject (Final)
URP 486 LandUseProject (Final)
Alonzo Lopez
 
The Chat Revolution
The Chat RevolutionThe Chat Revolution
The Chat Revolution
trs4
 
Why you should live stream your next major meeting
Why you should live stream your next major meeting Why you should live stream your next major meeting
Why you should live stream your next major meeting
Jim McConnell
 
20161024 R語言資料分析實務 (3)
20161024 R語言資料分析實務 (3)20161024 R語言資料分析實務 (3)
20161024 R語言資料分析實務 (3)
羅左欣
 
Ad

Similar to Mcv design patterns (20)

Spring Web Presentation 123143242341234234
Spring Web Presentation 123143242341234234Spring Web Presentation 123143242341234234
Spring Web Presentation 123143242341234234
horiadobrin
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
Ashton Feller
 
Enterprise java unit-1_chapter-2
Enterprise java unit-1_chapter-2Enterprise java unit-1_chapter-2
Enterprise java unit-1_chapter-2
sandeep54552
 
enterprisejavaunit-1chapter-2-210914075956.pdf
enterprisejavaunit-1chapter-2-210914075956.pdfenterprisejavaunit-1chapter-2-210914075956.pdf
enterprisejavaunit-1chapter-2-210914075956.pdf
EidTahir
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar
 
J2EE Patterns
J2EE PatternsJ2EE Patterns
J2EE Patterns
Emprovise
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
baabtra.com - No. 1 supplier of quality freshers
 
J2 ee archi
J2 ee archiJ2 ee archi
J2 ee archi
saurabhshertukde
 
Architectural Design & Patterns
Architectural Design&PatternsArchitectural Design&Patterns
Architectural Design & Patterns
Inocentshuja Ahmad
 
Web tier-framework-mvc
Web tier-framework-mvcWeb tier-framework-mvc
Web tier-framework-mvc
KashfUlHuda1
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
Qamar Abbas
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitecture
ABDEL RAHMAN KARIM
 
Introduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classIntroduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training class
QUONTRASOLUTIONS
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorials
TIB Academy
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
Innovation Studio
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
Mukesh Kumar
 
Persentation
PersentationPersentation
Persentation
Accord Software & Systems
 
Asp.net mvc 5 ppt
Asp.net mvc 5 pptAsp.net mvc 5 ppt
Asp.net mvc 5 ppt
JavedAnsari65
 
Spring Web Presentation 123143242341234234
Spring Web Presentation 123143242341234234Spring Web Presentation 123143242341234234
Spring Web Presentation 123143242341234234
horiadobrin
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Enterprise java unit-1_chapter-2
Enterprise java unit-1_chapter-2Enterprise java unit-1_chapter-2
Enterprise java unit-1_chapter-2
sandeep54552
 
enterprisejavaunit-1chapter-2-210914075956.pdf
enterprisejavaunit-1chapter-2-210914075956.pdfenterprisejavaunit-1chapter-2-210914075956.pdf
enterprisejavaunit-1chapter-2-210914075956.pdf
EidTahir
 
J2EE Patterns
J2EE PatternsJ2EE Patterns
J2EE Patterns
Emprovise
 
Architectural Design & Patterns
Architectural Design&PatternsArchitectural Design&Patterns
Architectural Design & Patterns
Inocentshuja Ahmad
 
Web tier-framework-mvc
Web tier-framework-mvcWeb tier-framework-mvc
Web tier-framework-mvc
KashfUlHuda1
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
Qamar Abbas
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitecture
ABDEL RAHMAN KARIM
 
Introduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classIntroduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training class
QUONTRASOLUTIONS
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorials
TIB Academy
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
Innovation Studio
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
Mukesh Kumar
 
Ad

Recently uploaded (20)

Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 

Mcv design patterns

  • 2. Design Patterns • A pattern is a proven solution to a problem in a context. • Christopher Alexander says each pattern is a three-part rule which expresses a relation between a certain context, a problem, and a solution. • Design patterns represent a solutions to problems that arise when developing software within a particular context. i.e Patterns = problems.solution pairs in a context
  • 3. Background • Started in 1987 by Ward Cunningham and Ken Beck who were working with Smalltalk and designing GUIs. • Popularized by Gamma, Helm, Johnson and Vlissides (The gang of four, Go4) • The three of Go4 were working on frameworks (E++,Unidraw, HotDraw) • Design pattern use a consistent documentation approach • Design pattern are granular and applied at different levels such as frameworks, subsystems and sub-subsystems • Design patterns are often organized as creational, structural or behavioral
  • 4. Categorizing Pattern Patterns, then, represent expert solutions to recurring problems in a context and thus have been captured at many levels of abstraction and in numerous domains. Numerous categories are: • Design • Architectural • Analysis • Creational • Structural • Behavioral
  • 5. Sun’s J2EE Framework • Components Containers and Connectors: Hiding Complexity, Enhancing Portability • Components are the key focus of application developers • Containers intercede between clients and components, providing services transparently to both, including transaction support and resource pooling. • Connectors sit beneath the J2EE platform, defining a portable service API to plug into existing enterprise vendor offerings.
  • 6. J2EE • Components ▫ Enterprise Java Beans (EJB) ▫ Java Server Pages (JSP) ▫ Servlets • Containers (service providers) ▫ Web container ▫ Bean Container • Connectors (connection service providers)
  • 8. J2EE and Design Patterns • J2EE: AN OPERATING SYSTEM FOR THE WEB Enterprise web applications, which live on networks and are accessible through browsers, are redefining Enterprise Web Software. This is the next wave of computing. • The J2EE architecture is built to enable component developers to use a Model View Controller (MVC) Design Pattern.
  • 9. Details of MVC Design Pattern • Name (essence of the pattern) ▫ Model View Controller MVC • Context (where does this problem occur) ▫ MVC is an architectural pattern that is used when developing interactive application such as a shopping cart on the Internet. • Problem (definition of the reoccurring difficulty) ▫ User interfaces change often, especially on the internet where look-and-feel is a competitive issue. Also, the same information is presented in different ways. The core business logic and data is stable.
  • 10. MVC continued • Solution (how do you solve the problem) ▫ Use the software engineering principle of “separation of concerns” to divide the application into three areas:  Model encapsulates the core data and functionality  View encapsulates the presentation of the data there can be many views of the common data  Controller accepts input from the user and makes request from the model for the data to produce a new view.
  • 12. MVC Architecture • The Model represents the structure of the data in the application, as well as application-specific operations on those data. • A View (of which there may be many) presents data in some form to a user, in the context of some application function. • A 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.
  • 13. Example of MVC Design Pattern • Let’s investigate this statement by looking at a small application that demonstrates MVC on J2EE
  • 14. Java Pet Store- MVC Design Pattern  The Java Pet Store is a reference application that demonstrates J2EE technologies.  It demonstrates interaction between Java Server Pages (JSP's), custom Tag Libraries, JavaBeans, and Enterprise Java Beans.  It demonstrates a real-world approach to application development, where the presentation of data is separated from the process of obtaining data from objects which interact with the enterprise or database tier.  The Pet Store application implements MVC (Model-View- Controller) design, and demonstrates one way to design an application that should scale well.
  • 15. Multi Tier Architecture  The Java Pet Store design is divided into multiple tiers: A. Client tier B. Web tier C. Enterprise JavaBeans tier D. Enterprise Information System tier.  These tiers are not necessarily arranged hierarchically.  Each tier may communicate directly with other tiers, or indirectly by way of intermediate tiers.
  • 17. A. Details of Client Tier • The Client tier is responsible for presenting data to the user, interacting with the user, and communicating with the other tiers of the application. • The Client tier is the only part the application the user ever sees. • The Client tier communicates with other tiers by way of well-defined interfaces. • A separate Client tier in the design provides flexibility and extensibility.
  • 18. A. Details of Client Tier • In The Java Pet Store Client tier consists mainly of a browser displaying Web pages generated from server-side JSP pages in the Web tier. • Future new clients can be written using technologies or languages that do not yet even exist, since they must conform only to the interface for communicating with other tiers
  • 19. B. Web Tier • The Web tier is responsible for performing all Web-related processing, such as serving HTML, instantiating Web page templates, and formatting JSP pages for display by browsers. • The Web tier in the Java Pet Store does all of these, and takes on the Controller functions for the Web application, caching model data interpreting user inputs, selecting appropriate Views based on application flow, and managing database connections.
  • 20. C. EJB Tier • Enterprise JavaBeans are software business components which extend servers to perform application-specific functionality. • The interface between these components and their containers is defined in the EJBs specification. • Essentially, the EJBs tier provides a component model for access to distributed system services and persistent data.
  • 21. C. EJB Tier • Both stand-alone clients and Web applications in the Web tier can use EJB components hosted by the EJBs tier. • It also simplifies application component development, because details about system issues such as persistence, reentrancy, transactions, remote access, and so on, are all handled by the container.
  • 22. D.Enterprise Information System (EIS) Tier • The EIS tier is the enterprise information infrastructure. • Members of the EIS tier typically include enterprise information planning (ERP) systems, transaction processing monitors, relational database management systems, and legacy enterprise applications. • Access to the EIS tier is usually transactional, to ensure that data are consistent across application boundaries. • The EIS tier also enforces security and offers scalability.
  • 23. MVC supports Modular Design  Has set of modules, each tightly coupled internally, and loosely coupled between modules.  Each module has an interface that defines the module's functional requirements and provides a place where third- party products may be integrated.  The Java Pet Store demo modules are:  User Account  Product Catalog  Order Processing  Messaging  Inventory  Control  The Modular design supports the design goal of reusable software.
  • 24. Java Pet store- MVC • Views ▫ JSP pages, composed with templates and displayed in an HTML browser • Controller ▫ maps user input from the browser to request events, and forwards those events to the Shopping Client Controller in the EJB tier. • Model ▫ EJB Tier
  • 25. MVC Details in Java Pet store • Model represents the structure of the data in the application, as well as application-specific operations on data - CartModel, InventoryModel, CustomerEJB, and others • Views are Java server pages (JSPs) ▫ rendered from the web container to the browser, stand-alone applications that provide View functionality, and interfaces to spreadsheet programs, such as the StarOfficeTM suite. • Controller is server side java program (Servlet) ▫ MainServlet.java, which dispatches browser requests to other controller objects, such as ShoppingClientController.java, AdminClientController.java, and their related support classes.
  • 26. Views:Java Server Page (JSP) • http://java.sun.com/products/jsp/ • Technology for developing dynamic web sites that replaces CGI • Thought of as a server-side scripting tool • Contains HTML and Java code (scripts) • Is compiled into a servlet and executes on the server.
  • 27. Controller Servlet • A java class that runs on the server • Extends http Servlet • Runs in a container class (servlet/JSP engine) • Application servers (Jrun, WebLogic) have the containers • This has the logic for the application
  • 28. EJBs • Enterprise Java Beans Connect Servlets to the back end database • Examples of EJBs in Java Pet store are: AccountHandler, ModelUpdateManager, ShoppingClientControllerHome, CartHandler, ShoppingClientControllerEJB, SigninHandler, OrderHandler
  • 29. Advantages of MVC • Separating Model from View (that is, separating data representation from presentation) - easy to add multiple data presentations for the same data, -facilitates adding new types of data presentation as technology develops. -Model and View components can vary independently enhancing maintainability, extensibility, and testability.
  • 30. Advantages of MVC design Pattern • Separating Controller from View (application behavior from presentation) - 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.
  • 31. Consequences or Benefits • We make changes without bringing down the server. • We leave the core code alone • We can have multiple versions of the same data displayed • We can test our changes in the actual environment. • We have achieved “separation of concerns”
  • 32. References • Home of the patterns community http://hillside.net/ • Adaptability home page ▫ http://www.utdallas.edu/~chung/adaptability.html • Quickest road to understanding the concepts non-software examples ▫ http://www.agcs.com/supportv2/techpapers/patterns/papers/tutnotes/ index.htm • The Sun location for J2ee ▫ http://java.sun.com/j2ee/ • Sun’s Java Pet store example used ▫ http://jboss.utdallas.edu:8080/estore