Post on 21-Dec-2015
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
Client machine
Server machine
DB machine
Presentation Layer
Web Layer
Business Layer
EIS Layer
browser
Web server
Applicationserver
DB server
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
JSP / ServletsFrameworks(Struts,JSF etc)
HTML/Applets
JavaBeans / EJB
Server Presentation
Client Presentation
Business
Layers Java/J2EE Technology
DAO / ConnectorsData
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:
Container infrastructure, language and environment support
Web Technology Java Servlets JavaServer Pages (JSP) JavaServer Pages Standard Tag Library (JSTL) JavaServer Faces (JSF)
Platform services 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 TierCommunication 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
Matrixinput.jsp
Matrixresult.jsp
ControllerServlet
MatrixMultiplier
MatrixDAO
Matrix
Beann
Business layer
Data layer
Controller layer
Server sidePresentation layer
HTMLClient sidePresentation layer
Matrix Multiplication: Layer by Layer View
Case Study: Matrix Multiplication
Example Code
netBeans4.1 Project