Click here to Skip to main content
15,850,921 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi there ! I've had a big talk with one of my colleague on his application code.

I wonder about should I declare the database related tasks in the BAL ( BLL ) because my mate, he declares his t-sql, object's properties and its INSERT, UPDATE...method in his BAL class. And he only then pass the query as argument to the DAL for executing.
His DAL only has a duty that execute that query and returns.

In my point of view, for every object there should be corresponsive BAL and DAL.

So, I would like to ask which one will give it the most benefit or none of them :) ?

We're just Junior programmer.
Sergey Alexandrovich Kryukov 28-Nov-13 11:29am    
There is no such people as "3-tiers architects". There are architects and non-architects... :-)
The question does not really make any certain sense.
phil.o 28-Nov-13 11:31am    
There could be! See:
- architect's head
- architect's body and arms
- architect's legs
This way you have a clear separation of concerns ^^
Sergey Alexandrovich Kryukov 28-Nov-13 11:43am    
"When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck".

No! It does not have to be a duck. It could be an architect working at duck typing. :-)

OriginalGriff 28-Nov-13 12:02pm    
And with many architects, physically separating them into those piles would be a bonus...:laugh:

1 solution

Database tasks (including SQL) should be in the DL, not the BL.

Part of the idea of the 3 Tier Model is that you can extract a layer and bolt a new one in without affecting the others in any way. If you limit this by moving data related tasks (including preparing SQL) into the BL then you are restricting what the DL can be replaced with. FOr example, if you use MsSQL specific functions in your BL, you can't replace the DL when the company switches to MySql, SQLite, SQLCE, CSV files, or some future technology.

The layers are supposed to be independent of each other!
Share this answer
Minh Dat Nguyen 28-Nov-13 11:46am    
Yes, thanks! You light up my mind.
OriginalGriff 28-Nov-13 12:00pm    
You're welcome!

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