473,833 Members | 2,133 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 9458
"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
4326
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 separate ASP pages with each new page
7
2926
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 several different classes for providers/application specific code, thought of a separate assembly...
6
4083
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 contain the public properties and the get/set functions for the object. Is this an appropriate naming...
10
9191
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 get anywhere. There's just a lot of theory here I don't understand. 1.) I understand (I think)...
1
2589
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 cannot find stored procedure, but when I execute the "Use <DBName>" and then execute the statement, it...
10
9098
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 this new app will likely spawn background threads periodically to update business objects throughout...
13
2074
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
2711
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 unit test is atomic and makes as few assumptions about its runtime environment as possible. But...
1
1406
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 will finish (with success or
0
9796
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10500
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10543
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10213
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7753
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5624
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4422
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3078
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.