67

What's the difference between application layer and business logic layer? I kind of understand that business layer provides business specific services and application layer couples business services and provides services to the end user (Web Service, UI, etc). Am I right?

Ram
  • 143,282
  • 16
  • 168
  • 197
miceuz
  • 3,327
  • 5
  • 29
  • 33
  • possible duplicate of [Business and application logic?](http://stackoverflow.com/questions/1456425/business-and-application-logic) – nawfal Jan 12 '15 at 11:10

6 Answers6

75

That sounds about correct.

The business layer implements the Domain Model in a boundary-technology-neutral way. In other words, it doesn't depend on any particular UI or service interface-related technology, such as web libraries or windowing APIs. You should be able to consume the business layer from any type of application - web, rich client, web service, etc.

The application layer bridges the gap between the business layer and the boundary technology.

Mark Seemann
  • 225,310
  • 48
  • 427
  • 736
  • 10
    What does "boundary technology" mean in this context? – pseudocoder Jan 03 '13 at 06:27
  • 9
    Any technology that sits at the boundary of an application. UI frameworks, database access libraries, service gateways, HTTP or SOAP frameworks, file system libraries, specific message queueing libraries, etc. – Mark Seemann Jan 03 '13 at 08:47
  • 1
    If you follow DDD there is also the presentation layer which can be html, wpf, rest api, etc. The application layer is reused by the different presentation layers. The diff between bus/domain and application is that the domain only consist of objects that are known to business (or abstractions that work for dev)and are named by a coomon language that is shared by bus peopel and devs (the ubiquitous language). The app layer is what makes it a "program" – buckley Jan 03 '13 at 19:54
  • +1 for the simple but clear term "You should be able to consume the business layer from any type of application - web, rich client, web service, etc." – Rexxo Mar 14 '14 at 14:13
  • What do you mean here by "Domain Model"? I keep seeing this phrase in my research without a definition. – Thomas May 28 '14 at 13:37
  • @MarkSeemann it does, thank you. And, I took the answer a bit deeper. Check out this sweet Wikpedia article about [problem] [Domain](http://en.wikipedia.org/wiki/Problem_domain) – Thomas May 28 '14 at 13:57
  • Could you pls provide an example? I was redirected from here: http://www.bennadel.com/blog/2436-what-the-heck-is-business-logic-anyway.htm Now it would be great if you could help in putting stuff in respective layers in mentioned example. – Snehal Masne Sep 08 '14 at 06:23
  • 1
    @SnehalMasne This might be one place to start: http://blog.ploeh.dk/2013/12/03/layers-onions-ports-adapters-its-all-the-same – Mark Seemann Sep 08 '14 at 12:41
  • so does application layer reused by multiple presentations eg. wpf, web? – Eldar Dec 01 '14 at 13:06
  • 1
    @eldar *"The application layer bridges the gap between the business layer and the boundary technology,"* so if the boundary technology differs, the application layer will have to do so as well. – Mark Seemann Dec 01 '14 at 14:22
  • I would suggest that the application layer can be written in a way that is boundary technology agnostic, as long as the architectural pattern supports it. In fact, I believe that's what cross-platform frameworks are doing. – funct7 Feb 24 '21 at 07:01
24

To summarize:

  • The application layer consists of those elements that are specific to this application. So that would contain the UI, back-end processing for the UI, and any bindings between the application and your business logic layer. In a perfect world, this layer would not contain any logic of the business domain.

  • The business logic layer (BLL) contains logic specific to the business domain. Also, if you are going to create a separate BLL, this layer should contain logic that could be used by other applications as well as this one. For example, a set of web services exposing a well-defined API. This de-couples the BLL from your application and allows you the flexibility to build other applications on top of it in the future.

Justin Ethier
  • 131,333
  • 52
  • 229
  • 284
  • Can you provide a source for this? Your first bullet sounds like what I normally hear referred to as the presentation layer. – Bill the Lizard Apr 13 '10 at 15:31
  • Unfortunately, no. I took his comment to mean the layers of his code specific to the application, as opposed to a business-specific BLL layer. But you are right, normally `Application Layer` is used in the context of the OSI model. – Justin Ethier Apr 13 '10 at 16:18
  • 2
    I agree with Justin completely. Application layer should only contain minimal logic (IE: does the field have whitespace or how many chars). Business logic should only work and validate on the data itself. This is why it frustrates me to see embedded SQL in the Application layer, where no-one in the Business logic can re-use it! – Vippy Feb 21 '14 at 17:25
3

in classic layering in Business Layer we have:

-Business Rules -Security -User Activity Loging -Transaction Management ...

Functional Requierment + NonFunctional Requierment = Business Code

in DDD Functional Requierment Like Business Rules and Business Logic Stay in Domain Layer And NonFunctional Requiement Like Security and User Activity Loging Stay in Application Layer

3

As I understand it the business layer is in charge of the business decisions AKA the logic involving the protocols of the client.

The application layer are the raw processes that have nothing to do with business decisions.

Javier Parra
  • 2,020
  • 2
  • 18
  • 32
0

I think of it as infrastructure. Depending on the application, it can contain the plumbing for configuration, reporting, the UI shell, etc.

Big Endian
  • 944
  • 1
  • 6
  • 23
-2

In my head, the divide between Business and Application logic is this: Business logic manages data, Application logic manages users

—— from a comment here: https://www.bennadel.com/blog/2436-what-the-heck-is-business-logic-anyway.htm#comments_41200

Pang
  • 9,564
  • 146
  • 81
  • 122
A.com
  • 1,466
  • 4
  • 19
  • 31