By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,496 Members | 1,489 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,496 IT Pros & Developers. It's quick & easy.

CODING PRACTICE. Business and Data Access Layers

P: n/a
Why separate the Data Access Layer (DAL) methods from the Business Layer
(BL)methods of an object ? Why not have them inside the object itself, since
it's going to save its own data, using its own methods?

Is it just a matter of avoiding clutter of the code? Or try to avoid big
objects in memory? Won't the DAL object consume memory by itself anyway?
Any reasonable explanation is appreciated.

TIA
Iordanis

Jul 20 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
its because of the benefits to abstraction. what if the data store
changes, what if the bl layer needs to run on a in-memory model. what if
the underlying database changes? none of these should effect the bl code
unless it has the data access in them.

also for professional developers who write units test, combining the
layers make writing the unit tests more difficult.

-- bruce (sqlwork.com)

Savvoulidis Iordanis wrote:
Why separate the Data Access Layer (DAL) methods from the Business Layer
(BL)methods of an object ? Why not have them inside the object itself, since
it's going to save its own data, using its own methods?

Is it just a matter of avoiding clutter of the code? Or try to avoid big
objects in memory? Won't the DAL object consume memory by itself anyway?
Any reasonable explanation is appreciated.

TIA
Iordanis
Jul 20 '08 #2

P: n/a
#1 Business Objects do not have to exist If and Only If there is a database
counter part. Case #1, UnitTests.
#2 Your backend datastore could change, thus layers give you a better way
to maintain your code.

You can look at an example here:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!139.entry
(code is downloadable).

There is a MS "bird's eye view" article I reference. Read and reread that
article several times. Bookmark it, and in a few months, go back and reread
it.


"Savvoulidis Iordanis" <Sa*****************@discussions.microsoft.comwrot e
in message news:79**********************************@microsof t.com...
Why separate the Data Access Layer (DAL) methods from the Business Layer
(BL)methods of an object ? Why not have them inside the object itself,
since
it's going to save its own data, using its own methods?

Is it just a matter of avoiding clutter of the code? Or try to avoid big
objects in memory? Won't the DAL object consume memory by itself anyway?
Any reasonable explanation is appreciated.

TIA
Iordanis

Jul 21 '08 #3

P: n/a
Is the 3-tier approach applied in webforms that use webform controls and
datasources such as gridview the sqldatasource controls? Doesn't the
combination of these controls destroy the 3-tier approach? Should I fill the
gridview with data only through code that gets the data from the business
layer, OR by using gridview/sqldatasource properties (the easy way)? I
believe using both methods is inapropriate.
Any comments? How is it done in serious web page development?

TIA
Iordanis
Jul 21 '08 #4

P: n/a
"Savvoulidis Iordanis" <Sa*****************@discussions.microsoft.comwrot e
in message news:55**********************************@microsof t.com...
How is it done in serious web page development?
Depends on your definition of "serious", I suppose...

Personally, I do everything in code and never go anywhere near things like
SqlDataSource, Validation controls, Design view etc...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 21 '08 #5

P: n/a

Most of those were developed for RAPID development.

In my opinion, RAPID != Good Development.

...

"Savvoulidis Iordanis" <Sa*****************@discussions.microsoft.comwrot e
in message news:55**********************************@microsof t.com...
Is the 3-tier approach applied in webforms that use webform controls and
datasources such as gridview the sqldatasource controls? Doesn't the
combination of these controls destroy the 3-tier approach? Should I fill
the
gridview with data only through code that gets the data from the business
layer, OR by using gridview/sqldatasource properties (the easy way)? I
believe using both methods is inapropriate.
Any comments? How is it done in serious web page development?

TIA
Iordanis

Jul 21 '08 #6

P: n/a
Are applications developed without the datasource controls, but only using
code for gridviews etc, any faster? Why do you follow this approach? Isn't
Rapid App Development the Holy Grail of programming? How faster do you work
coding the way you do now?
Any philosophical discussion on that is appreciated (if you can spare any
time on philosophy, that is)

TIA
Iordanis
Jul 23 '08 #7

P: n/a
"Savvoulidis Iordanis" <Sa*****************@discussions.microsoft.comwrot e
in message news:91**********************************@microsof t.com...
Are applications developed without the datasource controls, but only using
code for gridviews etc, any faster?
No idea...
Why do you follow this approach?
For much greater control over what I'm doing...
Isn't Rapid App Development the Holy Grail of programming?
Absolutely not!!! Rapid application development DOES NOT necessarily mean
good application development. Have you ever seen Microsoft FrontPage...?
How faster do you work coding the way you do now?
Much faster.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 23 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.