架构指南 [英] Architecture guidelines

查看:70
本文介绍了架构指南的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据经验,从c#winforms app中的表单代码中抽象应用程序

功能是一种好习惯吗?我有一个

的单一表单应用程序,但我不知道我应该在哪里进行主要的

处理,如果我应该使用Form类实例或创造

一个引擎上课,做一切吗?是否有一般的

指南?


希望有意义......;)

As a rule of thumb, is it good practice to abstract application
functionality from the form code behind in a c# winforms app? I have a
single form application, but I''m not sure where I should be doing my main
processing, if I should be working with the Form class instance or creating
an "engine" class and doing everything there? Are there any general
guidelines?

Hope that makes sense... ;)

推荐答案

你好史蒂夫,


这是一个很好的做法,从所有的东西中消除应用程序功能,而不是

形式:)

你需要从你的func代码中提取界面。

顺便说一句,它已经从代码中分离出来的FW2.0形式


S> ;根据经验,抽象应用是一种很好的做法

S>来自c#winforms应用程序背后的表单代码的功能?我有

S>单个表单应用程序,但我不确定我应该在哪里做

S>我的主要处理,如果我应该使用Form类

S>实例或创建引擎上课并做所有事情?

S>是否有任何一般指导原则?

S>

S>希望有意义......;)

S>

---

WBR,

Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour


有时一个人仍忠于某一事业,因为它的对手不会因为b $ b不再是平淡无奇的。 (c)Friedrich Nietzsche
Hello Steve,

it''s a good practice to absctact app functionality from the everything, not
form :)
U need to extract interface from yout func code.
by the way, it the FW2.0 forms already separated from code

S> As a rule of thumb, is it good practice to abstract application
S> functionality from the form code behind in a c# winforms app? I have
S> a single form application, but I''m not sure where I should be doing
S> my main processing, if I should be working with the Form class
S> instance or creating an "engine" class and doing everything there?
S> Are there any general guidelines?
S>
S> Hope that makes sense... ;)
S>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche




" Michael Nemtsev" <是ne ***** @ msn.com>在消息中写道

news:43 *************************** @ msnews.microsof t.com .. 。

"Michael Nemtsev" <ne*****@msn.com> wrote in message
news:43***************************@msnews.microsof t.com...
你好史蒂夫,

这是一个很好的做法,从所有东西中消除应用程序功能,
不是形式:)
你需要提取来自你的功能代码的界面。顺便说一下,它已经与代码分开了FW2.0表格

S>根据经验,抽象应用是一种很好的做法。
S>来自c#winforms应用程序背后的表单代码的功能?我有
S>单个表单应用程序,但我不确定我应该在哪里做什么
S>我的主要处理,如果我应该使用Form类
S>实例或创建引擎上课并在那里做所有事情?
S>是否有任何一般指导原则?
S>
S>希望有意义......;)
S>
---
WBR,
Michael Nemtsev ::博客: http://spaces.msn.com/members/laflour

有时一个人仍忠实原因只是因为它的对手做了b $ b而且不会停止平淡。 (c)Friedrich Nietzsche
Hello Steve,

it''s a good practice to absctact app functionality from the everything, not form :)
U need to extract interface from yout func code.
by the way, it the FW2.0 forms already separated from code

S> As a rule of thumb, is it good practice to abstract application
S> functionality from the form code behind in a c# winforms app? I have
S> a single form application, but I''m not sure where I should be doing
S> my main processing, if I should be working with the Form class
S> instance or creating an "engine" class and doing everything there?
S> Are there any general guidelines?
S>
S> Hope that makes sense... ;)
S>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche




嗨迈克尔,谢谢你的回复

我不知道你的意思这里FW2.0表格已经与

代码分开了

你能详细说明吗?



Hi Michael, thank you for the reply
I''m not sure what you mean here "it the FW2.0 forms already separated from
code"
can you elaborate please?


"史蒂夫" < ss*@sss.com> écritdansle message de news:

%2 **************** @ TK2MSFTNGP11.phx.gbl ...

|根据经验,抽象应用是好的做法

|来自c#winforms应用程序背后的表单代码的功能?我有一个

|单一表格申请,但我不知道我应该在哪里做我的主要

|处理,如果我应该使用Form类实例或

创建

| 发动机上课,做一切吗?有没有一般的

|指南?


你正朝着一个非常好的方向前进:-)


理论上,你应该能够构建和测试所有您的商务课程

根本没有任何UI;使用NUnit来建立您的测试框架。然后,一旦

你已经证明你的业务类是无错误的,你可以开始

想想如何显示那些实例的属性

课程。


当然,您应该将应用功能与UI分开;您可能还需要考虑将您的应用功能与数据库分开

连接;请参阅我的网站上的一些关于OPF(对象持久性框架)的文章

我的网站 www .carterconsulting.org.uk 他们的目标是德尔福,但

原则是相同的。


乔安娜


-

Joanna Carter [TeamB]

顾问软件工程师
"Steve" <ss*@sss.com> a écrit dans le message de news:
%2****************@TK2MSFTNGP11.phx.gbl...

| As a rule of thumb, is it good practice to abstract application
| functionality from the form code behind in a c# winforms app? I have a
| single form application, but I''m not sure where I should be doing my main
| processing, if I should be working with the Form class instance or
creating
| an "engine" class and doing everything there? Are there any general
| guidelines?

You are heading in a very good direction here :-)

In theory, you should be able to build and test all your business classes
without any UI at all; using NUnit to buid your test framework. Then once
you have proven that your business classes are "bug-free", you can start to
think about how you want to display the properties of instances of those
classes.

Certainly, you should separate you app functionality from you UI; you might
also consider separating your app functionality from your database
connectivity; see some articles on OPFs (Object Persistence Frameworks) on
my website www.carterconsulting.org.uk they are targetting Delphi but the
principles are the same.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


这篇关于架构指南的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆