I want to know are there any design patterns for web besides MVC?
I know there are design patterns as: Registry, Observer, Factory, ActiveRecord ,… and MVC a set of other design patterns and folder structure.
Is there design pattern like MVC is a set of other design patterns?
Edit :
my programming language is PHP.
6
There are different patterns in software development; MVP, MVVM, MVC, etc. are some of the well-known ones. However, you have to define the specific problem or technology that you are intending to solve or use.
Each of these patterns is good to solve some specific sets of problems. For example, the MVP (Model View Presenter) pattern helps to introduce separation of concerns in ASP.NET WebForms development. It consists of splitting up the responsibilities for gathering, displaying, and storing data from a web page into separate objects: a Model object, a View object, and a Presenter object.
The most famous general cookbook of design patterns is Gang of Four (GoF) design patterns.
Edit: i suppose that you are more interested in implementing design patterns on .NET platform
10
A nice pattern, which I came accross a few weeks ago, is MOVE.
It looks a bit more sophisticated as MVC, but is based on the same principle.
One downside of MVC is your controllers can get really, really big. Using the MOVE pattern, you’ll handle this issue, a little bit.
Other patterns, named by the others, are also good alternatives.
4
The first thing to establish is what exactly you need to do, to decide whether or not a framework and/or MVC (or other design pattern) would be of benefit.
Frameworks are there to provide a consistent platform for development whilst usually providing solutions to common programming requirements (such as Database interaction, form creation and validation, user authentication etc.)
For PHP at least the MVC / HMVC design pattern does tend to dominate the mainstream frameworks available (e.g. Zend, CakePHP, CodeIgniter etc.) but there are many different design patterns that one could use.
MVC is so popular because it offers an established and understood way of separating data modelling and processing logic from view/presentation layer (something which is considered desirable in order to produce robust, scalable applications).
It’s important to note (and as was expressed by @Marjan Venema in a comment to @ElYusubov’s answer) that MVC, MVP, MVVM and the other MVx patterns are (in principal at least) all the same ‘design pattern’.
Typically different design patterns all serve (often subtly) different purposes and in several cases were developed with a specific language in mind. However a true ‘design pattern’ is not a hard and fast rule to programming and is really more of a philosophical / idealogical understanding of a programs implementation and design requirements and logical function(s).
Research is the best way to find out about different programming principals and best practices, here’s some Wikipedia links to get you started:
- Design Pattern
- Design by Contract
- Software Design Pattern
- Architectural Pattern
- Interactional Design Pattern
In practice there’s nothing stopping you from implementing your own ‘pattern’, IMO the best way is to learn by doing, for me at least I didn’t fully understand the MVC pattern until I started trying to write a web site using it.
Once you understand some of the programming concepts and best practices you can use those to build your own system to solve the specific problems you’re facing and to meet your needs, whether it conforms to an established ‘pattern’ or not.
If you have no specific set of problems to solve then learning one of the common frameworks is your best bet.
One of the most famous examples is Knockout.js which is a javascript framework which uses the MVVM design pattern. There is a great article here over on stack overflow comparing the MVC framework Backbone.js vs Knockout.js.
A sidenote is that the MVVM design pattern originated from Microsoft as a specialization of the PM design pattern of Martin Fowler. MVVM is used extensively by WPF applications.
3
As ElYusubov pointed out, the ASP.Net framework has long had MVP and MVVM patterns, if you are looking for relatively mainstream examples. One of the main differences between MVC and MVVM is how your entities are updated; MVC is better suited to the traditional stateless or semi-stateless approach of web applications. The ASP.Net framework tried to work around this by keeping your state embedded in a form (so it could be restored on each request), which made the MVP and MVVM patterns make more sense there.
With HTML5, applications are becoming more and more JavaScript-heavy, with much of their state being on the client. This may lead to a resurgence in MVVM frameworks, and Knockout JS is one example.
Most patterns in the wild are MVC, or some flavor of MVC. After all it makes sense to split up your data (Model), the representation (View) and interaction with it (Controller). If you have a look at MVC as it was founded in the 80’s, you will find out it was never meant to be a web framework. Thus i found it to be far overburden in the web.
An other well known pattern would be the Service Oriented Architecture (SOA). Built on that, a modern approach would be to have an MVC (or flavor) on your server, only to expose a service you can work with. On the client side there would be an other MVC styled application, for example an HTML5 and JavaScript powered web application (Twitter or Linked In for example). The client application would use your server side service (the “View” of the server) as its Model. IMHO, this would be state of the art and will probably push server side only MVC aside.
I’m personally looking into implementing something that uses the idea of Resource Methods Representation, though at this stage it’s mostly just an experiment more than anything else. It does have some compelling points in that it models a HTTP request/response better than MVC (which is meant for long-lived applications running on a single computer as opposed to short-lived request/response sessions). However, it does have the drawback that if you put methods in your resources for handling GET, POST, PUT, DELETE, etc, then your resources become coupled to the front end. I’m thinking I’m going to separate that out into another layer.
There are more than 1000 way except MVC some of them are similar to MVC and some totally different
for example :
- Model-Template-View – MTV
- Model–view–presenter – MVP
- Hierarchical model–view–controller HMVC
- Model View ViewModel- MVVM
etc
2