Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need a business logic layer? [closed]

Tags:

c#

asp.net

I'm developing ASP.net application which use web services. There are no data base connections directly from my application -- all the activities are handled using web services.

In the UI layer I can do the data customizations and validations using a few lines of Linq code. What are the drawbacks if I don't have a business layer for my application?

like image 231
Damith Avatar asked Mar 15 '11 21:03

Damith


People also ask

Why do we need a business logic layer?

In programming, the Business Logic Layer (BLL) serves as an intermediary for data exchange between the presentation layer and the Data Access Layer (DAL). The Business Logic Layer handles the business rules, calculations, and logic within an application which dictate how it behaves.

What is the use of business logic layer in asp net?

The Business Logic layer handles all of the business rules, calculations and actual logic within your application that makes it actually "do" things and it may often use some of the objects retrieved from your data-access layer.

What does the business layer do?

It acts as an interface between the user and the application. Business Logic Layer: It acts as an intermediate between the Presentation and the Data Access Layer. Data Access Layer: The layer at which the data is managed.

Should you put business logic in the database?

Business logic is supposed to be the part of the application where you deal with customer or user facing decisions and computations. It is often argued that this part should be well separated from the rest of the technical infrastructure of your code.


1 Answers

Putting all your validation and business logic into its own tier is good for many reasons.

  1. It keeps all of your business logic localized, and in one place. Future changes will be much easier as a result.

  2. It allows you to more easily unit test your business logic. This is a big one. It's very difficult to write automated unit tests against your business logic if this code is tightly coupled to your web page, or windows form.

  3. It keeps your UI much slimmer.

See also: single responsibility principle (in a nutshell, your UI classes should do UI things, not business-logic things).

like image 89
Adam Rackis Avatar answered Oct 05 '22 12:10

Adam Rackis