C# 桌面应用程序:架构框架?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/150403/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Desktop Applications: Architectural Frameworks?
提问by Christophe Herreman
I'm wondering if there are any architectural frameworks out there to create desktop or standalone applications, in Java or C# for instance. It seems that there are tons of them available for web applications but I can't find many good resources on frameworks or architectural best-practices for desktop development.
我想知道是否有任何架构框架可以在 Java 或 C# 中创建桌面或独立应用程序。似乎有很多可用于 Web 应用程序,但我找不到很多关于框架或桌面开发架构最佳实践的好资源。
Ideally I would like to know if there is any source code available of desktop applications that would be considered to have a good architecture or are built with a certain framework.
理想情况下,我想知道是否有任何可用的桌面应用程序源代码被认为具有良好的架构或使用特定框架构建。
采纳答案by mmcdole
While not directly related to desktop applications if you are looking for decent source code for well written projects I asked a similar question:
如果您正在为编写良好的项目寻找体面的源代码,虽然与桌面应用程序没有直接关系,但我问了一个类似的问题:
Open source C# projects that have extremely high code quality to learn from.
People gave some pretty good suggestions there:
人们在那里给出了一些很好的建议:
- Scott Hanselman's The Weekly Source Codeseries (usually managed C#)
- Code written by Microsoft Patterns & Practicesteam.
- SharpDevelop(written in C#)
- Mono(most of the framework in C#)
- Paint.Net(written in C#)
- NHibernate(written in C#)
- The Castle Project(written in C#)
- xUnit(written in C#)
- .Net Framework Source Code
- Scott Hanselman 的The Weekly Source Code系列(通常管理 C#)
- 由Microsoft 模式与实践团队编写的代码。
- SharpDevelop(用 C# 编写)
- Mono(C# 中的大部分框架)
- Paint.Net(用 C# 编写)
- NHibernate(用 C# 编写)
- 城堡项目(用 C# 编写)
- xUnit(用 C# 编写)
- .Net 框架源代码
回答by Robert S.
You can use some of the same approaches in client development that you use in web development, such as Model View Presenter. The System.Windows.Forms namespace has everything you need to build a client application in C#, with the rest of the .NET Framework available to provide the services you need (such as IO and remoting).
您可以在客户端开发中使用一些与 Web 开发中使用的方法相同的方法,例如 Model View Presenter。System.Windows.Forms 命名空间拥有在 C# 中构建客户端应用程序所需的一切,.NET Framework 的其余部分可用于提供所需的服务(例如 IO 和远程处理)。
As far as source code for solid architectures in desktop apps, look at the code for Paint.NETand SharpDevelop. Both have very different approaches that will be interesting to you.
至于桌面应用程序中实体架构的源代码,请查看Paint.NET和SharpDevelop的代码。两者都有非常不同的方法,您会很感兴趣。
Sorry for the .NET slant of this reply. It's what I know best. :)
很抱歉此回复的 .NET 倾向。这是我最了解的。:)
回答by Panos
Check Microsoft's Smart Client Software Factory. It contains code samples and documentation.
检查 Microsoft 的智能客户端软件工厂。它包含代码示例和文档。
Overview
This software factory provides proven solutions to common challenges found while building and operating composite smart client applications. It helps architects and developers build modular systems that can be built and deployed by independent teams. Applications built with the software factory use proven practices for operations, such as centralized exception logging.
The software factory contains a collection of reusable components and libraries, Visual Studio 2008 solution templates, wizards and extensions, How-to topics, automated tests, extensive architecture documentation, patterns, and a reference implementation. The software factory uses Windows Forms, Windows Presentation Foundation, Windows Communication Foundation, and the Enterprise Library 3.1 – May 2007 release. With this release, the Composite UI Application Block is included in the software factory.
概述
该软件工厂为构建和运行复合智能客户端应用程序时发现的常见挑战提供经过验证的解决方案。它帮助架构师和开发人员构建可由独立团队构建和部署的模块化系统。使用软件工厂构建的应用程序使用经过验证的操作实践,例如集中式异常日志记录。
软件工厂包含一组可重用的组件和库、Visual Studio 2008 解决方案模板、向导和扩展、操作方法主题、自动化测试、广泛的体系结构文档、模式和参考实现。软件工厂使用 Windows 窗体、Windows Presentation Foundation、Windows Communication Foundation 和 Enterprise Library 3.1 – 2007 年 5 月版。在此版本中,复合 UI 应用程序块包含在软件工厂中。
回答by anjanb
In Java, Naked Objects -- http://nakedobjects.org/home/index.shtml
在 Java 中,裸对象——http://nakedobjects.org/home/index.shtml
JMatter -- implementation of naked objects -- http://jmatter.org/. pretty good.
JMatter——裸对象的实现——http: //jmatter.org/。非常好。
both of them are open source.
它们都是开源的。
回答by Guy Starbuck
There's a new .NET architectural guidance package from Microsoft patterns & practices for WPF that is code named "Prism"-- it's basically a "next generation" Composite UI Application Block (without the SCSF tooling). It uses Dependency injection, Composite pattern throughout, etc.
微软 WPF 模式和实践中有一个新的.NET 架构指导包,代码名为“Prism”——它基本上是一个“下一代”复合 UI 应用程序块(没有 SCSF 工具)。它使用依赖注入、复合模式等。
There is a pretty good DNRTVscreencast demoing it.
有一个很好的DNRTV截屏视频演示它。
回答by Alex Miller
In the lightweight app category, JSR 296 for Java (to be in future Java 7 possibly) is a framework handling the basics like resource management and actions. Lots of links here:
在轻量级应用程序类别中,JSR 296 for Java(可能在未来的 Java 7 中)是一个处理资源管理和操作等基础知识的框架。这里有很多链接:
Scaling up a bit, you could look at various RCP frameworks like:
稍微放大一点,您可以查看各种 RCP 框架,例如:
- Eclipse RCP: http://wiki.eclipse.org/index.php/Rich_Client_Platform
- NetBeans Platform: http://www.netbeans.org/products/platform/
- Spring RCP: http://spring-rich-c.sourceforge.net/1.0.0/index.html
- Comparison article: http://www.infoq.com/news/eclipse-rcp-netbeans-platform
- Eclipse RCP:http: //wiki.eclipse.org/index.php/Rich_Client_Platform
- NetBeans 平台:http: //www.netbeans.org/products/platform/
- Spring RCP:http: //spring-rich-c.sourceforge.net/1.0.0/index.html
- 对比文章:http: //www.infoq.com/news/eclipse-rcp-netbeans-platform
UPDATE: It has been mentioned (by Mark Reinhold at Devoxx '08) that JSR 296 will be included in Java 7.
更新:已经提到(由 Mark Reinhold 在 Devoxx '08 中提到)JSR 296 将包含在 Java 7 中。
Further update: JSR 296 is dead. JavaFX is the current direction for client-side Java.
进一步更新:JSR 296 已死。JavaFX 是客户端 Java 的当前方向。
回答by Odd
We develop in .NET technologies here.
我们在这里使用 .NET 技术进行开发。
Our friends here working on client applications develop their software to the Model View Presenter design pattern that is often associated with Web Development. For them they find it works very well, I believe it may be worth checking out.
我们在这里从事客户端应用程序的朋友将他们的软件开发为通常与 Web 开发相关联的模型视图展示器设计模式。对于他们来说,他们发现它非常有效,我相信它可能值得一试。
The Smart Client Factory (mentioned by Panos) may also be useful to you, though it's not a framework but more of a library of best practice solutions to common problems.
Smart Client Factory(Panos 提到)也可能对您有用,尽管它不是一个框架,而是一个解决常见问题的最佳实践解决方案库。
回答by Kevin Day
On the Java side, there are several projects aimed at Rich Client Platforms (RCP is the new buzzword for 'desktop' apps):
在 Java 方面,有几个针对富客户端平台的项目(RCP 是“桌面”应用程序的新流行语):
- Eclipse RCP (if you are OK using SWT instead of Swing)
- Spring RCP (which is in the process of being overhauled into Spring Desktop)
- NetBeans RCP (which I'm not particularly impressed with, but that is getting some traction)
- JSR 296 (Application Framework) - I actually really like this one
- Eclipse RCP(如果您可以使用 SWT 而不是 Swing)
- Spring RCP(正在大修成Spring Desktop)
- NetBeans RCP(我对它没有特别的印象,但它得到了一些牵引力)
- JSR 296(应用程序框架)——我真的很喜欢这个
Google any of the above and you'll get tons of info.
谷歌上面的任何一个,你都会得到大量的信息。
回答by Daniel Hiller
Specifically to organized presentation framework of ui functions we have been using infonode docking windows, that's a windowing framework using an eclipse like appearance (drag views anywhere, close them, undock them etc., skinnable of course). there's a gpl version for open source products out, altough afaik the developer licence is not that expensive ($299 each).
特别是对于我们一直在使用infonode 停靠窗口的 ui 功能的有组织的呈现框架,这是一个使用 eclipse 样外观的窗口框架(将视图拖到任何地方,关闭它们,取消它们等,当然可以换肤)。有一个开源产品的 gpl 版本,尽管开发者许可证并不昂贵(每个 299 美元)。
回答by Vassili Altynikov
I would recommend CSLA .NET framework by Rockford Lhotka: http://www.lhotka.net/cslanet/Default.aspx
我会推荐 Rockford Lhotka 的 CSLA .NET 框架:http://www.lhotka.net/cslanet/Default.aspx
It comes will full source code as well as sample client applications built in ASP.NET, WinForms and WPF.
它将提供完整的源代码以及在 ASP.NET、WinForms 和 WPF 中构建的示例客户端应用程序。