从ASP.Net Webforms毕业反模式(Graduating from ASP.Net Webforms anti

编程入门 行业动态 更新时间:2024-10-26 17:28:46
从ASP.Net Webforms毕业反模式(Graduating from ASP.Net Webforms anti-patterns [closed])

在我目前的项目中,我陷入了ASP.Net 2.0 Webforms反模式泥潭。 我知道我们正在使用的无数反模式(巨大的代码隐藏,没有关注点分离,不可测试的代码,以及等等)。 现在,我没有兴趣从这种情况中拯救这个应用程序,因为它太过分了。 相反,我的重点是我将在不久的将来进行的其他项目,我非常希望从这些反模式中毕业。

我最近在ASP.Net MVC,优秀的OO设计(Head First OOA&D和Eric Evans DDD书籍),设计模式(Head First Design Patterns)以及使用模拟的自动化单元测试(通过演示和博客)方面做了大量研究。 我正在寻找有关如何解决ASP.Net MVC 2项目的建议,同时实现良好的设计,灵活性,可维护性和可测试性。 你会建议我做些什么呢? 到目前为止,这是我的想法:

利用Head First OOA&D中概述的迭代方法进行开发,并在适用的情况下应用设计模式。 使用Linq到NHibernate进行数据访问,但也许避免使用Repository模式(Ayende在他的博客上表明它是NHibernate的一个不必要的层)。 我应该使用StructureMap还是其他IoC容器? 为了构建具有成员资格的ASPinNet MVC 2应用程序,支持媒体库,以及为管理用户提供一些简单的自定义CMS,我还需要知道什么?

在我看来,反模式之间应该保持平衡,并且可能会陷入DDD陷入困境。 只是一个想法。

谢谢,安迪

On my current project, I'm stuck in an ASP.Net 2.0 Webforms anti-pattern quagmire. I am aware of the myriad of anti-patterns we're using (huge code-behinds, no separation of concerns, untestable code, and on and on). Now, I'm not interested in rescuing this application from this situation as it's too far gone. Instead, my focus is on other projects that I will undertake in the near future for which I would very much like to graduate from these anti-patterns.

I have done a LOT of study recently in ASP.Net MVC, good OO design (Head First OOA&D and Eric Evans DDD book), design patterns (Head First Design Patterns), and automated unit testing with mocks (through presentations and blogs). I'm looking for advice on how to tackle an ASP.Net MVC 2 project while achieving good design, flexibility, maintainability and testability. What would you recommend that I do to achieve this? Here's my thoughts so far:

Utilize an iterative approach to development outlined in Head First OOA&D, and apply design patterns where applicable. Use Linq to NHibernate for data access, but perhaps avoid the Repository pattern (Ayende on his blog indicates that it's an unnecessary layer with NHibernate). Should I employ StructureMap or other IoC container? What else do I need to know in order to build a rockin ASP.Net MVC 2 application with membership, support for a media gallery, and some simple custom CMS for administrative users?

It seems to me that there should be a balance between anti-patterns, and potentially getting bogged down with DDD. Just a thought.

Thanks, Andy

最满意答案

IoC容器:适用于任何应用程序 存储库与否?:取决于您的应用程序将执行的操作。

尝试使用相同的工具在同一设计中使用每个应用程序也是一种反模式,因此请询问更具体的问题。

单一责任原则是最重要的设计原则。 当你在任何地方使用它时,你的代码都是可测试的,但是当你不习惯它时,这是最难学的东西。

IoC container: useful for any application Repository or not?: depends on what your application will do.

Trying to fit every app in the same design with the same tools is an anti pattern as well, so ask more specific questions.

The single responsibility principle is the most important design principle. Your code will be testable when you use that everywhere, but it's the hardest thing to learn when you are not used to it.

更多推荐

模式,Net,ASP,电脑培训,计算机培训,IT培训"/> <meta name="description"

本文发布于:2023-08-07 22:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466452.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模式   Net   ASP   Webforms   anti

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!