473,554 Members | 3,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BLL & DAL: How are they different?

First, just in case, BLL = Business Logic Layer and DAL = Data Access
Layer.

I guess this is really a question about architecture. I believe there
are many architect here.

Software architecture is sorta new to me. I searched a little and did
find this:

http://www.velocityreviews.com/forum...l-and-dal.html

It helped me understand a little bit about their differences and the
advantages of separating them. And now I do have one simple
question:

How do I know what needs to go to the BLL and what needs to go to the
DAL?

My guess is this: Any method that needs to do something like
connection.Open () and use a Sql command (including stored procedure)
should go into the DAL, right? Or is this a principle too naive in
software architecture?

Thanks for sharing your insights into this question.
Jan 28 '08 #1
11 9440
"gnewsgroup " <gn********@gma il.comwrote in message
news:b3******** *************** ***********@e23 g2000prf.google groups.com...
First, just in case, BLL = Business Logic Layer and DAL = Data Access
Layer.

I guess this is really a question about architecture. I believe there
are many architect here.

Software architecture is sorta new to me. I searched a little and did
find this:

http://www.velocityreviews.com/forum...l-and-dal.html

It helped me understand a little bit about their differences and the
advantages of separating them. And now I do have one simple
question:

How do I know what needs to go to the BLL and what needs to go to the
DAL?

My guess is this: Any method that needs to do something like
connection.Open () and use a Sql command (including stored procedure)
should go into the DAL, right? Or is this a principle too naive in
software architecture?
Not really, though stored procedures won't be in the DAL because they are
RDBMS objects...

Here's an easy (though perhaps over-simplistic) way to think of it.

Project A, Project B and Project C are all totally different, but they all
use SQL Server as their RDBMS. Therefore, they will all have different BLL
but can share the same DAL.

Project D, on the other hand, supports multiple RDBMS. Therefore, it might
have the same DAL as the Projects A, B & C, plus additional DALs which
support Oracle, MySQL, Postgre etc. Alternatively, it may have a single DAL
which supports multiple backend RDBMS through a factory pattern.

Essentially, the BLL and DAL should be completely independent to the extent
that you are able to change one of them without needing to change the
other...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 28 '08 #2
On Jan 28, 9:39 am, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
"gnewsgroup " <gnewsgr...@gma il.comwrote in message

news:b3******** *************** ***********@e23 g2000prf.google groups.com...
First, just in case, BLL = Business Logic Layer and DAL = Data Access
Layer.
I guess this is really a question about architecture. I believe there
are many architect here.
Software architecture is sorta new to me. I searched a little and did
find this:
http://www.velocityreviews.com/forum...l-and-dal.html
It helped me understand a little bit about their differences and the
advantages of separating them. And now I do have one simple
question:
How do I know what needs to go to the BLL and what needs to go to the
DAL?
My guess is this: Any method that needs to do something like
connection.Open () and use a Sql command (including stored procedure)
should go into the DAL, right? Or is this a principle too naive in
software architecture?

Not really, though stored procedures won't be in the DAL because they are
RDBMS objects...

Here's an easy (though perhaps over-simplistic) way to think of it.

Project A, Project B and Project C are all totally different, but they all
use SQL Server as their RDBMS. Therefore, they will all have different BLL
but can share the same DAL.

Project D, on the other hand, supports multiple RDBMS. Therefore, it might
have the same DAL as the Projects A, B & C, plus additional DALs which
support Oracle, MySQL, Postgre etc. Alternatively, it may have a single DAL
which supports multiple backend RDBMS through a factory pattern.

Essentially, the BLL and DAL should be completely independent to the extent
that you are able to change one of them without needing to change the
other...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
On Jan 28, 9:39 am, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
"gnewsgroup " <gnewsgr...@gma il.comwrote in message

news:b3******** *************** ***********@e23 g2000prf.google groups.com...
First, just in case, BLL = Business Logic Layer and DAL = Data Access
Layer.
I guess this is really a question about architecture. I believe there
are many architect here.
Software architecture is sorta new to me. I searched a little and did
find this:
http://www.velocityreviews.com/forum...l-and-dal.html
It helped me understand a little bit about their differences and the
advantages of separating them. And now I do have one simple
question:
How do I know what needs to go to the BLL and what needs to go to the
DAL?
My guess is this: Any method that needs to do something like
connection.Open () and use a Sql command (including stored procedure)
should go into the DAL, right? Or is this a principle too naive in
software architecture?

Not really, though stored procedures won't be in the DAL because they are
RDBMS objects...

Here's an easy (though perhaps over-simplistic) way to think of it.

Project A, Project B and Project C are all totally different, but they all
use SQL Server as their RDBMS. Therefore, they will all have different BLL
but can share the same DAL.

Project D, on the other hand, supports multiple RDBMS. Therefore, it might
have the same DAL as the Projects A, B & C, plus additional DALs which
support Oracle, MySQL, Postgre etc. Alternatively, it may have a single DAL
which supports multiple backend RDBMS through a factory pattern.

Essentially, the BLL and DAL should be completely independent to the extent
that you are able to change one of them without needing to change the
other...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
Thank you. I understand that there are a lot of advantages of
separating them. But I am still not sure what goes into the BLL, and
what goes into the DAL. Sounds like both layers can *rightfully*
access the database? Any hint? Thanks.
Jan 28 '08 #3
See:

http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!139.entry
I have a 2.0 version of the blog entry/code as well.

http://sholliday.spaces.live.com/Blog/
My rule of thumb is that the DAL returns:
1. DataSets
2. IDataReaders
3. Scalars
4. Voids/Nothings

You can read the why at the blog.

PS
Read the "bird's eye" view MS article I provide a URL to as well.


"gnewsgroup " <gn********@gma il.comwrote in message
news:b3******** *************** ***********@e23 g2000prf.google groups.com...
First, just in case, BLL = Business Logic Layer and DAL = Data Access
Layer.

I guess this is really a question about architecture. I believe there
are many architect here.

Software architecture is sorta new to me. I searched a little and did
find this:

http://www.velocityreviews.com/forum...l-and-dal.html

It helped me understand a little bit about their differences and the
advantages of separating them. And now I do have one simple
question:

How do I know what needs to go to the BLL and what needs to go to the
DAL?

My guess is this: Any method that needs to do something like
connection.Open () and use a Sql command (including stored procedure)
should go into the DAL, right? Or is this a principle too naive in
software architecture?

Thanks for sharing your insights into this question.

Jan 28 '08 #4
"gnewsgroup " <gn********@gma il.comwrote in message
news:f4******** *************** ***********@q21 g2000hsa.google groups.com...
Thank you. I understand that there are a lot of advantages of
separating them. But I am still not sure what goes into the BLL, and
what goes into the DAL. Sounds like both layers can *rightfully*
access the database?
Absolutely not! Only the DAL should access the RDBMS. If the BLL requires
interaction with the RDBMS, it uses the DAL...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 28 '08 #5
//
Sounds like both layers can *rightfully*
access the database? //

In my opinion:

NO.
The DAL talks to the DB.

The BAL talks to the DAL. Using the 4 things I mention at my blog (the
"returns" from the DAL), you can get what you need done.
And you're safe if you ever need to change RDBMS's.


"gnewsgroup " <gn********@gma il.comwrote in message
news:f4******** *************** ***********@q21 g2000hsa.google groups.com...
On Jan 28, 9:39 am, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
>"gnewsgroup " <gnewsgr...@gma il.comwrote in message

news:b3******* *************** ************@e2 3g2000prf.googl egroups.com...
First, just in case, BLL = Business Logic Layer and DAL = Data Access
Layer.
I guess this is really a question about architecture. I believe there
are many architect here.
Software architecture is sorta new to me. I searched a little and did
find this:
>http://www.velocityreviews.com/forum...l-and-dal.html
It helped me understand a little bit about their differences and the
advantages of separating them. And now I do have one simple
question:
How do I know what needs to go to the BLL and what needs to go to the
DAL?
My guess is this: Any method that needs to do something like
connection.Open () and use a Sql command (including stored procedure)
should go into the DAL, right? Or is this a principle too naive in
software architecture?

Not really, though stored procedures won't be in the DAL because they are
RDBMS objects...

Here's an easy (though perhaps over-simplistic) way to think of it.

Project A, Project B and Project C are all totally different, but they
all
use SQL Server as their RDBMS. Therefore, they will all have different
BLL
but can share the same DAL.

Project D, on the other hand, supports multiple RDBMS. Therefore, it
might
have the same DAL as the Projects A, B & C, plus additional DALs which
support Oracle, MySQL, Postgre etc. Alternatively, it may have a single
DAL
which supports multiple backend RDBMS through a factory pattern.

Essentially, the BLL and DAL should be completely independent to the
extent
that you are able to change one of them without needing to change the
other...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net

On Jan 28, 9:39 am, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
>"gnewsgroup " <gnewsgr...@gma il.comwrote in message

news:b3******* *************** ************@e2 3g2000prf.googl egroups.com...
First, just in case, BLL = Business Logic Layer and DAL = Data Access
Layer.
I guess this is really a question about architecture. I believe there
are many architect here.
Software architecture is sorta new to me. I searched a little and did
find this:
>http://www.velocityreviews.com/forum...l-and-dal.html
It helped me understand a little bit about their differences and the
advantages of separating them. And now I do have one simple
question:
How do I know what needs to go to the BLL and what needs to go to the
DAL?
My guess is this: Any method that needs to do something like
connection.Open () and use a Sql command (including stored procedure)
should go into the DAL, right? Or is this a principle too naive in
software architecture?

Not really, though stored procedures won't be in the DAL because they are
RDBMS objects...

Here's an easy (though perhaps over-simplistic) way to think of it.

Project A, Project B and Project C are all totally different, but they
all
use SQL Server as their RDBMS. Therefore, they will all have different
BLL
but can share the same DAL.

Project D, on the other hand, supports multiple RDBMS. Therefore, it
might
have the same DAL as the Projects A, B & C, plus additional DALs which
support Oracle, MySQL, Postgre etc. Alternatively, it may have a single
DAL
which supports multiple backend RDBMS through a factory pattern.

Essentially, the BLL and DAL should be completely independent to the
extent
that you are able to change one of them without needing to change the
other...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net

Thank you. I understand that there are a lot of advantages of
separating them. But I am still not sure what goes into the BLL, and
what goes into the DAL. Sounds like both layers can *rightfully*
access the database? Any hint? Thanks.

Jan 28 '08 #6
On Jan 28, 10:24 am, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
"gnewsgroup " <gnewsgr...@gma il.comwrote in message

news:f4******** *************** ***********@q21 g2000hsa.google groups.com...
Thank you. I understand that there are a lot of advantages of
separating them. But I am still not sure what goes into the BLL, and
what goes into the DAL. Sounds like both layers can *rightfully*
access the database?

Absolutely not! Only the DAL should access the RDBMS. If the BLL requires
interaction with the RDBMS, it uses the DAL...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
Fantastic, that sorta demystifies my confusion. Then, I have actually
been intuitively separating them in my web application. I've put most
methods that return DataTable, SqlDataReader, DataSet and those that
do insert, delete, update under App_Code.

Next question: Are event handlers considered in the presentation
layer? Should the code-behind file contain only event handlers and
everything else should go to either the BLL or DAL?

Thanks again.
Jan 28 '08 #7
"Scott Roberts" <sr******@no.sp am.here-webworks-software.comwro te in
message news:e4******** ******@TK2MSFTN GP02.phx.gbl...
What have you really gained here? The ability to swap out SqlClient for
OracleClient? I guess that's nice, but IMO doesn't go far enough.
Like I said in my first reply, this is a very simplistic explanation of BLL
and DAL...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 28 '08 #8
<zh****@gmail.c omwrote in message
news:d6******** *************** ***********@1g2 000hsl.googlegr oups.com...
Question: I suppose colParamaters should always be an array of string,
such that when we add more parameters to a stored procedure in the
RDBMS, we don't have to modify the code in the DAL, right?
Depends on the RDBMS but, for SQL Server, I use the SqlParameters
collection:
http://www.google.co.uk/search?sourc...=SqlParameters
BTW, do DAL mostly have static methods?
Depends... The Microsoft DAAB does, and mine does because I based it on the
Microsoft one...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 28 '08 #9
<ch*******@yaho o.comwrote in message
news:de******** *************** ***********@e6g 2000prf.googleg roups.com...
The DAL is usually a wrapper for the stored procedures used in
accessing data from the database. (That is if you are a stored proc
person).
And what if you aren't a stored procedure person...?
Your DAL might look like this:
public static DataTable GetStockDetails (DbTransaction tran, object SD_SRN)
That's precisely what your DAL *shouldn't* look like!

The DAL should not contain any reference to specific business logic, in this
case stock details.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 29 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4317
by: Brian Staff | last post by:
I was recently on a OO Design course<g> and as a result I've decided to "Tier" my ASP classic pages for maintainability. Browser <----> PT <---> BT <---> DT PT == Presentation Tier BT == Business Tier DT == Data Tier Right now, the browser communicates with just one ASP page and it's a fairly simple job to divide each one into 3...
7
2917
by: Steve | last post by:
Hi all, I'm designing my DAL layer(s) for our suite of applications and I'm designing myself in circles, it's gotten to the point where each idea just mixes me up more :) We have 3 loosely related applications and I would like to use an assembly for the DAL in each of them. I have thought of using a single assembly for all of them with...
6
4056
by: dm1608 | last post by:
I'm relatively new to ASP.NET 2.0 and am struggling with trying to find the best naming convention for the BAL and DAL objects within my database. Does anyone have any recommendations or best practices for naming my objects? I currently have all my type classses simply called "JobSummaryClass" or "JobDetailsClass". These classes simply...
10
9175
by: Roy | last post by:
Recently I've been trying to convert over my sqldatasource's to objectdatasource's to take advantage of the custom paging functionality of objectdatasource's. These attempts have plunged me knee-deep into unfamiliar territory and I'm starting to feel like a rank newbie. What makes it worse is that---despite my best efforts---I'm struggling to...
1
2569
by: den 2005 | last post by:
Hi everybody, I created several stored procedure in a local sql server 2005 express database, now when I call/execute them in the asp.net 2.0 web page, it returns an error message of "Cannot find the stored procedure '<proc_name>'", this is funny, when I execute the command in a sql query window "exec sp_GetAllArticles", it also returns...
10
9082
by: Fred Mertz | last post by:
I'm wondering what some of the important considerations are regarding implementing the DAL as a static class vs creating instances of it as needed. I'm writing a .NET 2.0 Windows application (MDI) that will communicate with a SQL Server; approximately 120 users. On smaller apps I have tended to implement the DAL as a static class. But...
13
2060
by: Jeff | last post by:
Hey ASP.NET 2.0 I'm designing the DAL (Data Access Layer) of my web application. I want every table to have a strongly typed object as wrapper arround the table. So that for example if the DAL found 3 records in the table then it sends a generic collection of 3 objects to the BLL (Business Logic Layer). But here is the problem:
30
2659
by: Cramer | last post by:
I've finally gotton board with TDD (test driven development) and wow is it effective! I went from sceptic to True Believer with my first effort. My question: According to the various books and articles I have read about TDD, a good unit test does not rely on the database or other such external/environmental conditions. More generally, a good...
1
1385
by: No Name | last post by:
Hello, I have one BLL object X with method Y. Inside method Y (*) I call DAL object(s). Operation Y can include more then one DAL object (dalObj1.Write, dalObj2.Write) so I create some kind of "token" with sql connection reference and pass it to DAL object(s) involved in operation Y (**). At some point in time (ambient) transaction...
0
7594
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
6137
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5430
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5151
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3544
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1125
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
835
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.