DSSD CS 565 - Suraj @ LUMS

Download Report

Transcript DSSD CS 565 - Suraj @ LUMS

Layers & Tiers
Umair Javed
Lec - 41
Layers & Tiers
 Layers are merely logical groupings of the software
components that make up the application or service.
 Whereas tiers refer to the physical residence of those
layers (hardware)
 In general,
 Layers – represents logical view of application
 Tiers – represents physical view of application
 However, both terms are used interchangeably.
Layers
Figure shows a simplified view of one application and its layers.
Tiers
browser
Web server
Application
server
DB server
Presentation Layer
Client machine
Web Layer
Server machine
Business Layer
EIS Layer
DB machine
Layers
[1]
 Presentation layer
 Collects user inputs
 Validates user inputs
 Presents the results of a computation
 Controls the screen flow
Layers
[2]
 Business Layer
 Concerned with the application specific
functionality
 Used to implement business rules and to
perform business tasks
 For example, in a banking system, banking
functions such as opening an account,
calculation of Tax, etc.
Layers
[3]
 Data Layer
 Concerned with the management of the data &
data sources of the system.
 Data sources can be database, XML , web
services, flat file etc.

Encapsulates data retrieval & storage logic

For example, the address book application needs
to retrieve all person records from a database to
display them to the user
Layers Support in Java
Layers
Java/J2EE Technology
Client Presentation
HTML/Applets
Server Presentation
JSP / Servlets
Frameworks(Struts,JSF etc)
Business
JavaBeans / EJB
Data
DAO / Connectors
Java 2 Enterprise Edition
(J2EE)
What is J2EE?
 Open and standard based platform
for:
 Development & deployment of n-tier web
based and component based enterprise
applications
 Reusability, enhance-ability, scalability &
interoperability
J2EE Suite

Core technology:


Web Technology





Java Servlets
JavaServer Pages (JSP)
JavaServer Pages Standard Tag Library (JSTL)
JavaServer Faces (JSF)
Platform services






Container infrastructure, language and environment support
Security
Transactions
Resources
Connectors
Java Message Service
And extensive support for


XML technology
Enterprise Java Bean (EJB) technology etc.
J2EE Distributed Multi-tiered
Applications
J2EE :
Multi-tiered Applications
J2EE :
Multi-tiered Applications
J2EE :
Multi-tiered Applications
servlets
Client Tier
Communication Options
Communication
with Business Tier
Case Study:
Matrix Multiplication
Using Layers
Case Study:
Matrix Multiplication
 Problem Statement
 Calculate product of two matrices of order 2
*2
 Result of multiplication should be stored
in DB as well as shown to the user.
Case Study:
Matrix Multiplication
 Format
 Input format
 input will be in 4,2,6,5 format separated by
commas where 4,2 represents entries of the first
row
 Display format
 Displays the matrix as a square
 Storage format
 Matrix will be stored as a string
Matrix Multiplication: Layer by Layer View
Client side
Presentation layer
Server side
Presentation layer
HTML
Matrixinput
.jsp
Matrixresult
.jsp
ControllerServlet
Business layer
MatrixMultiplier
Data layer
MatrixDAO
MatrixBeann
Controller layer
Case Study:
Matrix Multiplication
Example Code
netBeans4.1 Project