我开始使用一个 Linq2Sql 数据访问层, 它有一个“ 神级” 部分类, 其另一部分是生成的 JubeSet 。 这个部分类会做各种各样的事情, 比如将自己序列到 Json, 做数据库呼叫和各种工具功能, 以及定义一系列方便属性和与“ 部分” 模式互动的方法 。
作为副作用,它不可能 连成系列, 和所有其他的问题 与“上帝级”的反模式。
将这些班级分开以更好地将关注问题分开的好设计模式是什么? 我想强调降低影响,因为这个班级在整个应用程序中都充斥着。
我开始使用一个 Linq2Sql 数据访问层, 它有一个“ 神级” 部分类, 其另一部分是生成的 JubeSet 。 这个部分类会做各种各样的事情, 比如将自己序列到 Json, 做数据库呼叫和各种工具功能, 以及定义一系列方便属性和与“ 部分” 模式互动的方法 。
作为副作用,它不可能 连成系列, 和所有其他的问题 与“上帝级”的反模式。
将这些班级分开以更好地将关注问题分开的好设计模式是什么? 我想强调降低影响,因为这个班级在整个应用程序中都充斥着。
与大多数遗留代码Id 的重构一样,建议引入一个中间适配器类(见adapter 模式 ),该类从仅代表旧功能开始。然后,随着新代码的引入,包装器可以开始将工作委托给新代码。直到最终能够完全删除包装。
此外,我还要说,你应该写测试(单位或整合),只要你能够发现/核实该类各部分的功能,然后当再考虑因素时,你就会确定你没有破坏任何功能,因为你将有一套回归测试可以返回。
Since web applications are mostly stateless, and linear (request comes in, response goes out), is change-tracking really necessary? E.g. if I have an action that updates a Product instance I know at ...
Ok, the context is some serialization / deserialization code that will parse a byte stream into an object representation that s easier to work with (and vice-versa). Here s a simplified example ...
While designing ORM, what is the best approach to represent the relationship, performance-wise? I mean, out of the following two, which approach is best considering performance? class Employee { ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
Is there a design pattern for managing a queue or a stack? For example, we are looking to manage a list of tasks. These tasks will be added to a group queue, users will then be able to pull off the ...
I have started upgrading one of our internal software applications, written in ASP.NET Web Forms, and moving to ASP.NET MVC. I am trying to leverage the Repository design pattern for my classes, ...
I have a Car object which contains a latitude field and a longitude field. I use the observer pattern so that any time either of these fields change in my application, my car object is notified. I ...
How are models and DAOs supposed to interact? I m in the process of putting together a simple login module and I m unsure where to put the "business logic." If I put the logic with the data in the ...