The common tasks of web application framework(ex: Django or Laravel or .NET):
request / response abstraction
session state
user authentication & authorisation
page templating
URL mapping
DB access
security
caching
To implement above common tasks, MVC design pattern handles these tasks, as shown below:
-
URL mapping is handled by Controller of MVC. Controller routes requests to handlers. Ex:
http.ServeMux
is the controller from GOLang package -
request / response abstraction is performed by Controller by registering the handlers, written by web developer, as shown below:
sm := http.NewServeMux() // in GoLang sm.Handle("/", productHandler)
-
session state is handled by the handler code written by web developer
-
Page templating is handled by templating engine(view component) of MVC
-
user authentication & authorisation is handled by the handler code written by web developer
-
DB access is handled by model component of MVC.
-
security and caching is handled by handler code written by web developer
Is this the right understanding on MVC design pattern to implement common tasks of web application framework?
Aucun commentaire:
Enregistrer un commentaire