design patterns - Do you allow the Web Tier to access the DAL directly? -


I am interested in the alleged "best practice", which is nature with a small amount of reality.

In a web application, do you allow your web-level to reach DAL directly or should you go through a BLL first?

I am talking specifically about scenarios where there really is no "business logic" - such as a simple question: "Bring all the customers together with the nickname 'Atwood'. There is no argument, that is exactly known through BLL, so it is called.

When you may be this method is explained within a BLL object, then It seems to some extent even when the signature DLL ob The code will be the same, and the code will probably be as simple as a liner, so that the query will be sent to DLL.

If you select pre-employment a BLL object - What do the objects say? (Suppose they do a bit more than providing a query layer in DLL) Helpers?

Marty

Post-text "itemprop =

" text ">

In my opinion, you must always your web-level and your DAL ()

I appreciate it, more "simple" queries, BLL will imitate DAL closely (eg, get all countries, get all product type etc.) ), But honestly, even in your example:

(Bring all customers together with 'nickname' atwood)

there "Business Logic" has been summarized - a wish for data entry, by nickname If filtered, if nothing!

> By implementing BLL from the beginning of a project, it is incredibly easy to incorporate either the recognition or additional "logic" and when it may be needed (and if your project is a commercial application then its Approximately definitely arises if it is not in the beginning of the project). Add additional logic such as:

Get all the customers who have spent more than $ 10000 this year

or

Surname

To resolve this argument in the web tier Instead of trying, when a true BLL is involved, then 'atwood' costs more than $ 1000. Keeping in mind that with the above questions, we are almost certainly talking about many institutions and database tables, which have to meet with specially defined relationships to implement this functionality. Trying to get it by tampering DAL becomes confusing because you will deal with many institutions and classes. Here a BLL will make your web-level code very easy, because the relationship of the organization behind the BLL is a very simple interface.

This "" becomes important when the user interface needs to be changed. / P>

At least now on two separate occasions, I have worked on commercial web applications with a web site user interface, and ultimately they have been asked (to demand more integration within their software products To create an interface that offers exact same functionality as web site)

If I had included a business logic within my web level, then implementing my web service, I must duplicate that argument and write it again. As I did, I made sure that all business logic were explained within the BLL classes, which meant that I had to prepare a series of web service interface method calls, and plug them in to call the methods of BLL classes. (I really like to make web service API easier)

In everything, I can not think of a reason to include not in a BLL layer between my DAL and my web level.

The easiest, when BLL is closely related to "Mimix" DAL, yes, codes and functionality are repetitive, however, with a little more typing, it also makes it relatively easy to implement

When it is more involved (such as when important business logic exists from the beginning), it helps to reduce recurrence (theory) to isolate worries, whereas at the same time the future Helps simplify ongoing maintenance. / P>

Of course, it assumes that you are doing all this "by hand" if you so desire, you can help make DAL / BLL / UI layers very simple, many of them ! (I.e., etc)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -