I have done a task that implements a 3-tier architecture using the following design:
- Presentation Layer - Uses PHP by having an MVC framework to deal with frontend presentation and business logic. This layer makes calls towards the service layer, which accesses the information.
- Data Access Layer - Uses C# .Internet and it is separated into Service, Business Logic, and Data Layer. Known as through the Presentation Layer. Makes calls towards the database and serializes reactions revisit the Presentation Layer.
- Data Layer - The database. Provides all the data for that above two layers.
I realize that the three-tier approach might help security, since there's still no accessibility data when the Presentation Layer is jeopardized. Even though this is true, it appears such as this approach has ended-further complicating it a little, especially since I am instructed to write two models for the similar object within the first couple of layers.
So my question: Is a poor implementation of the three-tier architecture? If that's the case, how can it be enhanced? Do you know the disadvantages, if any, of simply getting an MVC implementation that can access the database? What approache(s) would you use for the web programs?
It appears in my experience much like your 3 tiers overlap with View, Controller Model. In case your php is principally making calls for your #2 layer, i quickly would think itself does not have to be MVC unless of course you've got a very complicated presentation layer that itself ought to be organized into MVC, for example for those who have complicated navigation or user authentication logic.
There's nothing necessary in programming. But you will find a lot of practices, which were prooven by years as something-you-can-follow-to-get-better-results. N-tier separation is among that practices.
Your description follows the description within the wiki, so - it's appropriate method to implement 3-tier application.
But don't forget, you do not should do anything - just follow the actual way it feels safe for you personally. As well as in future you will have your personal group of practices that meet your needs particularly.
I believe your complication comes from the truth that you are using PHP and .Internet, which are not directly compatible. Should you removed among individuals (only used PHP or only used .Internet) that will simplify things. Otherwise, I believe you are using a good idea.
The need for the approach isn't just for security, additionally, it facilitates maintainability.
I don't know I realize the concern: "especially since I am instructed to write two models for the similar object within the first couple of layers." This could appear to become since you are utilizing two different programming languages for that UI and also the back-finish. I am speculating C# "data access layer" consists of an entire object model that you simply then need to replicate inside your front-end.
The issue appears to become you have two middle tiers that mirror one another, because you are using two languages, not that you're utilizing a n-tier architecture
Something that let us you separate the different core areas of the application is useful. Although not needed. You need to choose a style and stay with it, however. Avoid using MVC in PHP at the very top, adding in additional layers. The M in MVC is the DAL in the N-tier structure.
If you wish to streamline the body some, do that:
- View/Templates at the very top - They are much like your V in MVC.
- Routing/Controller - This accepts page demands, routes towards the correct controller/handler, and foretells your computer data sources.
- Model/Data Access Layer - This is actually the use of your database. These may also be exterior such things as Facebook Connect or even the Twitter API.
- Data Layer - Your database itself
Splitting the Model and DAL into two steps is not really needed.
I would not build your databases an internet service unless of course you've got a valid reason to do this. Reasons are such things as: You intend to gain access to it as being an internet service using their company programs, not only that one front-end. By which situation it's a whole application and you must have two stacks of N-tier or MVC, not just one large one.