In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
How to understand the FubuMVC implemented by ASP.NET MVC? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Before the release of the official version of ASP.NET MVC, Jeremy D.Miller and Chad Myers did some work on earlier versions of ASP.NET MVC and made some changes to the underlying implementation. Later, they changed almost all of the ASP.NET MVC implementations, so they decided to construct another MVC implementation, FubuMVC, and soon Mark Nijhof was invited to join the project and become a major member.
Fubu stands for "For us,by us". Now FubuMVC does not use any ASP.NET MVC implementation code other than ASP.NET Routing, while ASP.NET Routing is already included in the .NET Framework 3.5 SP1.
Jon Arild T ø rresda asked what is the difference between Chad Myers,ASP.NET MVC and FubuMVC:
If I have to choose one, I choose "combination pair inheritance". This is a basic difference in design, but it's not that ASP.NET MVC is poorly designed, but I think ASP.NET MVC tends to use inheritance in class structure design, so it's not as easy to design dynamic Web applications as composition.
FubuMVC is a front controller (Front Controller) framework. Chad points out that the two main goals of this model are:
◆ separates different concerns for the request
◆ allows you to construct responses in a combined way to send back to the client
For the front-end controller, Chad explained: "it's not that we can't use ASP.NET MVC to implement the front-end controller, but it's very difficult."
There are many implementation decisions in FubuMVC, one of which is the "behavior" that is executed before and after the Action execution of Controller. Chad explains why they call it behavior and what it means in FubuMVC.
When I demonstrated an early version of FubuMVC to some people at a Virual ALT.NET (VAN) conference, Steven Harman (http://stevenharman.net) suggested that I call it "behavior" because the word accurately describes what happened, and I kind of like the name.
In FubuMVC, the implementation of behavior is actually a mixture of decoration pattern and responsibility chain pattern.
The behavior has full control over the request pipeline, it can add or modify requests, dynamically select the action to be executed and whether or not to execute action, it can modify or completely replace the output of the action, and execute some code after the request processing is completed. In fact, generating the display result is itself an act. FubuMVC uses the behavior itself to implement basic functions, which can be replaced or modified as needed.
Mark Nijhof shows this pipeline in his article FubuMVC and the Front Controller style framework:
"behavior opens up possibilities that are difficult to achieve in other frameworks," says Chad:
◆ 's ability to wrap the entire request in a try/catch/finally block
Ability of ◆ multi-level caching
◆ 's ability to dynamically determine which action to execute based on the runtime environment or request time
Another aspect of the MVC pattern is that it allows developers to unit test parts of UI that traditionally cannot be tested. Chad describes how Microsoft did this:
Microsoft has taken a big step forward in its recent update to the MVC framework (Beta,RC and final release), which has better support for unit testing than Preview 3. But I still think that overuse of inheritance and prevention code and deliberate non-use of interfaces make testing in ASP.NET MVC cumbersome.
He went on to explain how FubuMVC implements this model:
Instead, FubuMVC uses a simple, easy-to-mock interface, focusing on high cohesion and low coupling designs. Among them, low coupling is more successful, but all this is still under development, and I hope that future designs will improve the degree of cohesion.
FubuMVC is highly dependent on the SOLID principle, which gives it a high degree of flexibility, and developers can replace the entire set of parts in the framework with just one mock, and can use any mock framework they like.
FubuMVC doesn't have a lot of defensive code. Instead, it focuses on designing components that provide free control, and these constructs are the main places where client code exists: controller, behavior, view, and parts that can be overloaded.
There are few dependencies between FubuMVC classes, and the only dependencies are on interfaces, which can be easily simulated with mock objects.
Since Jeremy (the creator of the IoC container StructureMap) is included in the project, you might think that inversion of control and IoC containers will be more supported, and in fact they are:
The current version only supports StructureMap, but support for other containers is likely to be added in the future. The framework makes very little use of containers and is limited to configuration. The rest is done using the container's auto-binding feature, so "service location" is basically not used. For the only bit of service location, we use Microsoft Patterns and Practices's Common Service Locator for processing, which allows us to easily replace the underlying IoC containers attached to the CSL schema (most containers meet this condition).
FubuMVC also has a contrib project, and how does the goal of this project differ from the core framework of FubuMVC:
We wanted more freedom to develop FubuMVC, so we established FubuMVC Contrib. We want to try plug-ins so that more people can participate and they can try more with fewer restrictions while keeping the core framework stable.
The FubuMVC core framework will maintain a few members, will be more cautious about patches, and will make fewer changes to the framework. FubuMVC-Contrib will have more participants, more changes, lower requirements, and may have code that doesn't work or experimental code. When something interesting has been developed in contrib, you can merge it into the core framework or split it into separate projects.
Today, FubuMVC is not as mature as ASP.NET MVC, but its implementation is very interesting. We will wait and see how this framework will develop and how it will differ from that of ASP.NET MVC. For more information about FubuMVC, you can check out their wiki and Ryan Kelley tutorials to learn FubuMVC from scratch.
This is the answer to the question about how to understand the FubuMVC implemented by ASP.NET MVC. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.