UI, Business Logic Layer, Data Layer and where to put web services

The Murph picture The Murph · Sep 22, 2009 · Viewed 13.5k times · Source

We are developing a web application. We want to possibly reuse the work we do here for a different application that will use the same database, and use the same business rules for reading and writing to said database.

Which design would be more correct

  1. Having the UI call web services, which would use business objects containing the business logic, which would talk to the data access layer.

  2. Have the UI use business objects containing the business logic, which would call web services, which would then talk to the data access layer.

  3. Have the UI user business objects containing the business logic, which would talk to the data access layer.

Answer

Vitaliy Liptchinsky picture Vitaliy Liptchinsky · Oct 26, 2009

Don't mix logical design with physical design. Logical design operates over layers and physical design - tiers. Web Service is not a layer. It is simply a tier. In logical design there is standard approach: UI layer-> BL layer -> DAL In physical design all layers can reside within one client-side application connecting local database, or can be distributed over the remote tiers. But for distributed applications usually is added one more layer: Application layer, which hides from BL layer communication over the wire.