Search code examples
c#phpdatabasethree-tier

Is a three-tier application architecture necessary?


I've worked on a project that implements a three-tier architecture with the following design:

  1. Presentation Layer - Uses PHP with an MVC framework to handle frontend presentation and business logic. This layer makes calls to the service layer, which accesses the data.
  2. Data Access Layer - Uses C# .NET and is separated into Service, Business Logic, and Data Layer. Called by the Presentation Layer. Makes calls to the database and serializes responses to return to the Presentation Layer.
  3. Data Layer - The database. Provides all of the data for the above two layers.

I understand that a three-tier approach can help security since there is still no access to the data if the Presentation Layer is compromised. Although this is true, this approach is over-complicating it a bit, especially since I'm forced to write two models for the same object in the first two layers.

So my question: Is this a bad implementation of a three-tier architecture? If so, how could it be improved? What are the drawbacks, if any, of simply having an MVC implementation that has access to the database? What approach(es) do you use for your web applications?

Thanks for the help!


Solution

  • It looks to me like your 3 tiers are the same as View, Controller Model. If your php is mainly making calls to your #2 layer, then I would think itself doesn't need to be MVC unless you have a very complicated presentation layer that itself should be organized into MVC, for instance if you have complicated navigation or user authentication logic.