Read some information about MVC and do some MVC notes.
Break down the point of concern
There is an important concept in the MVC world-"decomposition concerns" (separation of concerns), which means that when you do software development, you can focus on the current object without being distracted by other objects in the same system, and focus on the development effort. In this way, not only easy to improve software quality, but also to speed up the understanding of the code speed.
The characteristics and advantages of the concept of decomposition focus
- Simplification of complexity
- Significantly improved serviceability
- More easily tested
Recommendations for developing an ASP. NET MVC Project
Don't repeat yourself:
Good software should not have too many iterations of the program code, so: Don ' t Repeat yourself
There's no perfect architecture, just the right architecture.
Appropriate design patterns help to improve the quality of the architecture
Split your head and cut it in at least 3 copies:
At least model, View, Controller, sometimes you can make service level,repository level, and so on.
Create a Responsible object:
MVC has split the definition of the model responsible for business logic, view is responsible for the front-end display, controller responsible for data flow control and other responsibilities, three division of labor, strict discipline, not to exceed
Standardizing object cooperation
I believe there will always be a better solution.
No one can write the software once to
Common issues in ASP. NET MVC
is the MVC paradigm back in the ASP era?
In the ASP era, there is no suitable template engine, all the program and visual logic mixed together, so the wording of the "spaghetti" style. In the ASP. NET Web Forms age, the concept of CB (code Behind) effectively separates the HTML code from the program code. And MS Imports the way Windows Forms are developed, viewstate and the event-driven model (Eventmodel). In the face of increasingly complex web requirements, Web form becomes extremely complex and difficult to maintain. There are a few people who can write viewstate more than 1MB. This shows that the bugs that derive from the knowledge of the ASP. NET page life cycle don't know how many. in the age of MVC, View should not be in the complex program or business logic, 20 Jin left to show the parts, such as Html,javascript, data display, form and so on. The controller then controls the rest, and the model is responsible for interviewing the data or validating the data format----to clarify the responsibilities between each other and then write a good "decomposition focus" architecture to improve the maintainability of the project.
How does ASP. NET MVC differ from the traditional ASP. NET Web forms development?
The annoying issues that ASP. NET developers will encounter:
- The evil Viewstate,easy leads to super-large controls that make the program out of control.
- Control components are not directly or too complex for HTML controls.
- It is not easy to develop with TDD mode (test Driven Development test drive development) or to write unit test programs easily.
The strengths of MVC:
- A clear "Decomposition focus" architecture will force you to write a program that is more webforms and easier to maintain
- Developmental and Community Support
- Gives you complete control over the output of HTTP
- Excellent development efficiency
- Easy-to-test architecture
- Architecture for easy division of labor
The drawbacks of MVC:
Lack of support for tools (and the feeling of WebForm is completely different)
Lack of support for mature component technology (only Servercontrol, HTML Helper at the moment)
What are the similarities between MVC and Web Forms?
The interface between the two handles the Web page is actually IHttpHandler, but WF (WebForm) is IHTTPHANDLER,MVC as the Mvchandler class to handle.
What parts of WebForm must be discarded?
Techniques that are not available in MVC include the following:
- ViewState
- ASP (page trace)
- ASP. NET time-driven model (Eventmodel)
- server controls (Servercontrol) are mostly not available, but server controls that do not work in ViewState can be used to display
- Default SiteMap Provider
simple function Comparison of MVC and WF
support function |
web Form |
mvc1.0/2.0 |
ViewState |
√ |
X |
Pagetrace |
√ |
X |
Eventmodel |
√ |
X |
Servercontrol |
√ |
Partial support |
System.Web.SiteMapProvider |
√ |
X |
Provider Model |
√ |
√ |
System.Web.Caching namespaces |
√ |
√ |
System.Web.SessionState namespaces |
√ |
√ |
System.web.Security namespaces |
√ |
√ |
Profile,membership,sitemap |
√ |
√ |
Other system.web.* functions |
√ |
√ |
Can M, V, C really be developed independently?
Can, but not absolutely. M is the architecture center of MVC, and with M you can get C and V to refer to these model, define all the controllers and actions that you plan to develop, and then create all the action and the corresponding view. This is the most efficient development method at the moment.
Can WF projects be moved incrementally to an MVC project?
No way.