Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Every One,

I am making a project in asp.net. I want to make it in 3-Tier architecture.
But I have a lot of doubts regarding 3-tier architecture.
if i said 3-tier means Business logic layer, data access layer and presentation layer.
presentation layer means .aspx page and data-access layer is a class file in which i will connect to database using stored procedure or inline queries.
so what is business logic layer? why we use it?


please explain me..
Posted
Updated 17-May-12 22:45pm
v2

A 3 tier Architecture is composed by 3 Main Layers
•PL Presentation Layer
•BLL Business Logic Layer
•DAL Data Access Layer

Each top layer only asks the below layer and never sees anything on top of it.

In your project, you can introduce a Business Logic Layer by introducing a WebService (as an example). This WebService can do some pre/post processing when communicating between PL and DAL.

If you use BLL, you PL can look like anything as long as it makes use of BLL. For eg, you can cater iPhone, Windows App, Web Apps by writing diffent PL.

Hope this helps.
 
Share this answer
 
Comments
Prasad_Kulkarni 19-Jul-12 1:21am    
My 5!
Hello friend.
Sure, there are plenty of reasons. The most important though is that if
anything about your business logic or your data logic changes (as always
happens), you can replace just one layer of code without having to disturb
the other.

The business layer is where your business rules are processed, the data
layer is where your data manipulation is done. Separating these also adds
another level of security to your applicaiton.
 
Share this answer
 
Comments
coolnavjot31 18-May-12 4:52am    
Hello ManavGuru,

I want to know from you that what are you saying business access layer is .aspx.cs file or other .cs file.

please tell me if any other know
uses of bl:
1)It keeps all of your business logic localized, and in one place. Future changes will be much easier as a result.

2)It allows you to more easily unit test your business logic. This is a big one. It's very difficult to write automated unit tests against your business logic if this code is tightly coupled to your web page, or windows form.

3)It keeps your UI much slimmer.
4)maintain existing code
5)reuse existing code
 
Share this answer
 
v2
Comments
coolnavjot31 18-May-12 5:01am    
hi every one,

I am showing a flow my application

public class dataaccesslayer // Data Access layer
{
public void A()
{
//some code here
}
}
public class BusinessLogicLayer //Business Logic Layer
{
public string AB()
{
dataaccesslayer obj = new dataaccesslayer();
obj.A();
}
}

and now code-behind file
form1.aspx.cs file.

private void ABC()
{
BusinessLogicLayer obj1= new BusinessLogicLayer();
obj1.AB();
}

I want to know above code flow is real 3-Tier architecture.
please help me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900