Saturday 2 September 2017

3-Tier architectuire

In my opinion, you have to distinguish between the MVC pattern and the 3-tier architecture. To sum up:
3-tier architecture:
  • data: persisted data;
  • service: logical part of the application;
  • presentation: hmi, webservice...
The MVC pattern takes place in the presentation tier of the above architecture (for a webapp):
  • data: ...;
  • service: ...;
  • presentation:
    • controller: intercepts the HTTP request and returns the HTTP response;
    • model: stores data to be displayed/treated;
    • view: organises output/display.
Life cycle of a typical HTTP request:
  1. The user sends the HTTP request;
  2. The controller intercepts it;
  3. The controller calls the appropriate service;
  4. The service calls the appropriate dao, which returns some persisted data (for example);
  5. The service treats the data, and returns data to the controller;
  6. The controller stores the data in the appropriate model and calls the appropriate view;
  7. The view get instantiated with the model's data, and get returned as the HTTP response.

No comments:

Post a Comment