构建项目的最佳方式是什么?

发布于 2024-07-13 19:32:50 字数 1432 浏览 6 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

迷爱 2024-07-20 19:32:50

这几乎就是我所做的,除了我有几个库项目,我试图在其中放置所有可重用代码。 然后我的模型和 DAL 位于这些库的顶部,只需向它们添加项目细节即可。

That's pretty much what I do, except I've got a couple of library projects where I try to put all my reusable code. Then my Model and DAL sit on top of these libraries, just adding project specifics to them.

怪我入戏太深 2024-07-20 19:32:50

对于数据层,我通常使用:

Company.ProjectName.Data (即 AdventureWorks.OrderManager.Data)

对于业务层,我更喜欢“ObjectModel”(我使用过“Business”或“BusinessLogic”)但这是数据在对象/类中聚集在一起的区域,所以为什么不这么命名呢?)。

Company.ProjectName.ObjectModel(即 AdventureWorks.OrderManager.ObjectModel)

对于 UI,我喜欢普通的旧“UI”或“演示文稿”...

Company.ProjectName.Presentation (即 AdventureWorks.OrderManager.Presentation)

For the data layer, I usually use:

Company.ProjectName.Data (i.e. AdventureWorks.OrderManager.Data)

For business layer I prefer something like "ObjectModel" (I have used "Business" or "BusinessLogic" but this is the area where data comes together in objects/classes so why not name it so?).

Company.ProjectName.ObjectModel (i.e. AdventureWorks.OrderManager.ObjectModel)

For UI, I like either plain old "UI" or "Presentation"...

Company.ProjectName.Presentation (i.e. AdventureWorks.OrderManager.Presentation)

人事已非 2024-07-20 19:32:50

我主要使用 Microsoft Patterns & 中推荐的分层架构。 实践.NET 应用程序架构:设计应用程序和服务。 文档描述了实现它的体系结构和.NET 技术。

替代文本

Mostly I use layered architecture as recommended in Microsoft Patterns & Practices Application Architecture for .NET: Designing Applications and Services. Document describes the architecture and .NET technologies to implement it.

alt text

ゝ杯具 2024-07-20 19:32:50

软件架构取决于要构建的软件类型。 如果您想做内核编程,则与应用程序开发相比,其他原则也适用。 当您要进行物理模拟、天气预报软件、软件 IDE 或编译器时,还适用另一个原则。

我假设您想做应用程序开发。 好吧,那么您很可能希望围绕您要反映的领域来设计您的软件。 但即便如此,仍有很多选择。

为了对这个大主题有更多的了解,我强烈建议阅读来自 Eric Evans领域驱动设计和来自 应用领域驱动设计和模式代码>吉米·尼尔森。

The software architecture depends on the type of software to build. If you want to do kernel programming other principles apply compared to doing application development. Yet another principles apply when your are going to do physical simulation, weather-forecast software, software IDE's or compilers.

I assume you want to do application developement. Well, then you will most probably want to design your software around the domain you are going to reflect. But even then there are lots of options.

For more insight in this big topic, I strongly suggest to read Domain Driven Design from Eric Evans and Applying Domain-Driven Design and Patterns from Jimmmy Nilsson.

眼泪都笑了 2024-07-20 19:32:50

我目前正在开发具有 3 层架构的前端 Web 应用程序:

  • 客户端层(浏览器)
  • 应用程序层(Java EE 应用程序服务器,应用程序所在的位置)
  • 后端层(大型机和遗留应用程序、各种数据库)

它具有分层架构,应用程序层中的各层为:

  • 表示层:生成将在客户端层中使用的 UI
  • 应用程序层:相当于用例,包含应用程序逻辑
  • 服务层:映射领域逻辑和数据Java 模型上的后端层
  • 集成层:与后端层通信并包含 JMS、电子邮件、...以及 DAO 和其他内容的网关

这只是一个示例项目结构,最终结果将取决于应用程序的类型。 您可以在 我对这个问题关于包的划分和命名策略。

您可以根据需要添加/交换/删除图层。 例如,在 SOA 中,您可以在应用程序层或服务层之上放置一个 Web 服务层,以便 ESB(企业服务总线)可以连接到您的应用程序或服务。 如果其中任何一个是不可能的或看起来非常困难,那么您就没有最佳的架构和设计。

在考虑项目结构并允许上述场景时,您想要的模块和组件的一些重要属性是:

  • 可测试性
  • 可重用性
  • 可维护性

您可以通过低耦合和高内聚的设计来实现这一目标。 通过按功能/抽象级别对模块进行分组来选择分层架构是一个好的开始。 在每一层中,按功能进一步分组也有帮助。 让每个更具体的层仅依赖于更通用层的接口也可以减少耦合。

I'm currently working on front-end web application that has a 3-tiered architecture:

  • Client tier (the browser)
  • Application tier (Java EE application server, where the application will live)
  • Backend tier (mainframe and legacy apps, various databases)

It has a layered architecture, and the layers in the Application tier are:

  • Presentation layer: generates the UI that will be used in the Client tier
  • Application layer: the equivalent of use cases, contains application logic
  • Service layer: maps domain logic and data from Backend tier onto a Java model
  • Integration layer: communicates with the Backend tier and contains gateways for JMS, email, ... and DAOs and other stuff

This is just an example project structure, and the end result will depend on the type of application. You can read more in my answer to this question on the division and naming strategy for packages.

You can add/swap/remove layers as you see fit. In a SOA for example, you can layer a Webservice layer on top of the Application layer or Service layer, so that the ESB (Enterprise Service Bus) can connect to your application or services. If any of this is impossible or seems very difficult, you don't have an optimal architecture and design.

When thinking about the structure of your project and to allow scenarios like the one above, some important properties of your modules and components you want are:

  • Testability
  • Reusability
  • Maintainability

You can achieve this by designing for low coupling and high cohesion. Choosing a layered architecture by grouping modules by the level of functionality/abstraction is a good start. Within each layer grouping further by functionality helps as well. Letting each more specific layer only depend on interfaces of a more general layer reduces coupling too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文