1

I want to create n-Tier architecture with a repository pattern. I'm wondering does it make sense to just duplicate all my calls up through the BLL layer and then access data only calls via the BLL? Or can I access some things directly through the DAL and some through the BLL?

Exitos
  • 29,230
  • 38
  • 123
  • 178
  • I personally only access my dal through my bll and will duplicate the calls. You never know when you may need to add some business logic and it is a lot easier to modify the call in the bll rather than having to add a new call to the bll. – Sean Barlow Apr 15 '12 at 14:26
  • How do you define "data only calls"? Why do you feel you are "duplicating calls" in the BL? What technology are you programming (Winforms, Webforms, MVC...?)? – P.Brian.Mackey Apr 17 '12 at 17:58

1 Answers1

0

IMO it doesn't make sense to duplicate just for the sake of it.
(though really every approach has its pros and cons, nothing is always wrong or good per se)

Usually though data layer deals with for example (simplified) a bit 'granulated' data that match tables exactly etc.

While your business layer could combine that and is more centered around the 'logic' and your logical model (then the data model and the data).

If you find yourself having an exact replica of the DAL in your biz layer, then you're most likely missing a point sort of. Some things may need to be reorganized, thrown away, or just simplified.

Or e.g. ask yourself following - if you want to e.g. replace the DAL with to work with different type of storage (different organization of things or anything that requires you to change how your data/DAL operates) - how is your BLL going to look like? The same? Your business layer should not 'follow the data' - it should have its own rules, more again about the logic of your domain, what you're doing. While data should be about data.

So, in short the question is mainly how you design your system - if you make a good use of a business layer (and normally you should unless it's relatively simple or e.g. you decide for entirely different architecture) then use it, if not there's no need to duplicate.

hope this helps.

NSGaga-mostly-inactive
  • 14,052
  • 3
  • 41
  • 51