Sei sulla pagina 1di 2

Coursework Enterprise Web Software Development

I. Three- Layer Module


5.1 What is a Layer?
When you work with the application, if the project is to create a small application
according to our very easily, but when you work with larger projects, need more
people to do more, the programming becomes more complex, so easier to
manage the components of the system as well as the influence of other
components when you change a component, we often have the same set of
components function together. Therefore, the programming model is born, one of
the programming model that is the model layer 3 (3 - Layer). A layer is a
reusable portion of code that performs a specific function. In the .NET
environment, a layer is usually set up as a project that represents this specific
function. This specific layer is in charge of working with other layers to perform
some specific goal. Lets briefly look at the latter situation first.

Data Layer: A DAL contains methods that helps the Business Layer to connect
the data and perform required actions, whether to return data or to manipulate
data (insert, update, delete and so on).
Business Layer: A BAL contains business logic, validations or calculations
related to the data. Though a web site could talk to the data access layer
directly, it usually goes through another layer called the Business Layer. The
Business Layer is vital in that it validates the input conditions before calling a
method from the data layer. This ensures the data input is correct before
proceeding, and can often ensure that the outputs are correct as well. This

Coursework Enterprise Web Software Development

validation of input is called business rules, meaning the rules that the
Business Layer uses to make judgments about the data.
Presentation Layer: The Presentation Layer contains pages like .aspx or
Windows Forms forms where data is presented to the user or input is taken
from the user. The ASP.NET web site or Windows Forms application (the UI
for the project) is called the Presentation Layer. The Presentation Layer is the
most important layer simply because its the one that everyone sees and uses.
Even with a well structured business and data layer, if the Presentation Layer
is designed poorly, this gives the users a poor view of the system.
5.2

Why to use a three- layer module?


Chng ta s dng m hnh 3 lp v 3 li ch sau:
Security: A physically separate middle-tier application server can increase
security because it adds an extra level of indirection between the web server
and the database. This means no direct route from the web server to the
database server and (e.g.) SQL protocols/ports don't need to be
allowed/opened on DMZ firewalls. If your web server gets hacked, your
application server is safe. Also, the attack surface on the web server is
reduced because there is a reduced amount of code, etc running on the web
server
Performance and scalability: A 3-tier architecture is more scalable than a 2-tier
architecture because the web-tier and middle-tier can be scaled differently if
necessary. An application server can be used to cache persistent data to
increase performance and scalability. Counter-arguments include that scaling
just a web server is simpler and caching could be done either locally in the
web server or by duplicating the data in a different format (e.g. a NoSQL
store alongside a SQL database).
Reuse and maintenance: A single physical middle-tier can be shared by a number
of clients, so reuse and maintenance is increased. As highlighted in Mike's
blog entry, a counter-argument is that this is possible by creating reusable
components that are simply deployed multiple times.

Potrebbero piacerti anche