固体设计原理和设计模式C# [英] SOLID Design Principle and Design Pattern C#
问题描述
我是WinForms开发者, 我现在正处于需要成为自己更好版本的地步,所以我试图遵循
SOLID设计原则。 我直接在UI图层中编写我的代码,如果我发现重复的代码,我会特别创建类,但我无法告诉我,我是否遵循OOP技术,因为它更有可能是助手班。
我现在正在读一些关于这个主题的书。我读过的一些书籍是
- 首创设计模式
- GoF设计模式
这些都是非常好的资源。我正在尝试按照他们的设计,但我有几个问题。
These are very good resources. I am trying to follow their design but i've got a few questions in mind.
- 假设我创建了一个登录表单,所以要将我的逻辑从UI,我需要为登录创建一个单独的类。这是否意味着我需要为我正在创建的每个表单创建一个单独的类?
- 当将UI与逻辑分开时,它是否会泄漏?我的意思是,你有一个你需要打破规则的场景吗?
当从UI中分离逻辑时,我明白我真的不需要引用
When separating the logic from the UI, i do understand that i really don't need to reference the
System.Drawing, System.Windows.Forms, etc
但我发现它总是打破这个规则。例如,我总是导入
but i find it to always break this rule. For example, i always import
System.Data
进入UI层导致违反规则,我倾向于混淆它们。
into the UI layer which result in breaking the rule, i tend to mix them up sometimes.
问候
推荐答案
Hi Dikong42,
Hi Dikong42,
感谢您在此发帖。
根据您的问题更多与Winform相关,我将把它移到
Windows Forms General 论坛以获得合适的支持。
According to your question is more related to Winform, I will move it to Windows Forms General forum for suitable support.
Visual C#讨论并询问C#编程语言,IDE,库,示例和工具。
The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools.
如果你有一些语法或代码错误,请随时与我们联系。我们将尽力为您提供解决方案。
If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.
感谢您的理解与合作。
最诚挚的问候,
Wendy
这篇关于固体设计原理和设计模式C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!