views:

194

answers:

4

It seems pretty silly to me. What don't I get?

+1  A: 

Business logic should be in your BLL. If you end up with "2 liner functions" in your BLL, did you accidentally put that business logic in your DAL or UI?

Bullines
+4  A: 

If your BLL never does validation or implements any business logic and always remains 2 liners, then yes it is pretty silly. If you do this though, you've probably missed the point of having a business logic layer and you have probably been doing your validation in the UI, or adding business logic in your UI or your DAL. There are very few applications that require no validation and have no business logic.

Rob Prouse
+1  A: 

While Rob and Bullines are often correct that the need to do this points to a deeper problem, there are legitimate instances in which going straight to the data access layer makes perfect sense. Writing a brainless method (or worse, entire object model) to wrap the data access layer is among the least useful things any programmer can ever do, so don't. You can feel good about not going through the business logic layer if there's a legitimate reason.

Greg
While I agree with you a bit, if you do this and then business logic needs to be introduced later, it makes it harder to do as you need to change every instance in the application code back to using the BLL. If you had spent the time in the first place, you would only have to modify the BLL method.
Rob Prouse
Similarly, if your data changes, you can invest time updating and maintaining an object model that doesn't do anything. So, either approach can waste your time in the future. I think there are times for one approach and times for the other.
Greg
+4  A: 

I've run into cases like this where my app calls a business layer to select a list of values. The business layer then calls through to the Dal to do the data access. In a lot fo these cases, there is no apparent reason for the business layer method that does the pass through, but it does leave room to add business logic, processing of the data, etc in the future. It also helps keep your app decoupled, which will make testing much easier.

So, I say keep the one liners, but if your inserts, updates, etc are still one or two lines, you need to re-think where you are doing your validation and business level data processing.

Andrew Van Slaars
THIS. It is important to decouple for unit testing if you are serious about writing software.
cfeduke