Hi,
My question is regarding design patterns, why most of the Web Applications currently employs Model-View-Controller Design Patterns as compared to other Design Patterns ?
Thanks.
Hi,
My question is regarding design patterns, why most of the Web Applications currently employs Model-View-Controller Design Patterns as compared to other Design Patterns ?
Thanks.
Well, almost all languages support it - it is a well known, easily recognized and well understood design pattern that fits into the paradigm of most web applications. In some cases, it may be overused - but generally it is a good choice for web applications - which are generally just glorified CRUD (Create/Read/Update/Delete) database front ends.
The MVC pattern lends itself naturally to the core of what the Web frameworks provides:
and keeping these concerns separate and not intertwined. It is often tempting to mix these concepts (e.g. SQL calls within a JSP/ASP page), which leads to maintenance problems. MVC helps to prevent that and put some structure into the overall web application.
Of course, other design patterns can still be used in the web application, but MVC fits the Web Framework's "serving of backend data" scheme, very well.
EDIT: as RibaldEddie points out: MVC is not just the separation of these concerns, but how the framework allows them to interact cleanly. Of course, there's more to the MVC pattern, this is not an exhaustive explanation of the pattern.
It's just a name taken from an older generation of paradigms for OOP GUI software development.
It's a name that was chosen for the web because back in the day when the web wasn't the focus for software development, MVC was how you could separate your concerns (or more accurately, encapsulate what varied).
Since people have had a real problem separating their concerns in the early days of the web, they used this name from desktop application programming to convince web developers that there is a better way.
Unfortunately, in my view, we have lost a little bit of what made MVC so powerful on the web. There are a lot of programmers who have only had experience with the web and its notion of MVC. I think if you look at some of the older desktop libraries you may find a new way of looking at the old notion of MVC. Hopefully that will give you an idea of where the really nasty problems live when it comes to architecting for the web.