业务对象的定义是什么
从标题来看,我认为这是一个直接的问题,但是当深入研究“业务对象的世界”时,我似乎无法明确指出业务对象应该是什么。我是否应该遵循任何最佳实践,甚至任何设计模式?
我找到了一本书“Expert C# Business Objects”,这是否是我获得更好理解的最佳起点?
From the title, I believe it to be a straight forward question, but looking into the "world of Business Objects" I can't seem to put my finger on anything solid as to what a Business Object should be. Are there any best practices that I should follow, or even any design patterns?
I have found a book, "Expert C# Business Objects", would this be my best starting point to get a better understanding?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
业务对象是指与其所代表的实体关联的业务行为或数据。
在应用程序中,您拥有执行应用程序应该执行的操作(业务内容)的代码,以及技术上允许其运行并与用户交互的代码。例如,在 MVC 模式中,业务内容将是模型的工作。
我认为这更好地解释了这一点。您还可以查看 MVC 模式并了解每一层的职责。一旦理解了这一点,就会更容易看出什么是“业务对象”。
A business object refers to the business behavior or data associated with the entity that it represents.
In an application you have code that does what the application is supposed to do (the business stuff) and code that technically allows that to run and interact with the user. For example, in a MVC pattern, the business stuff will be the Model's job.
I think this explains it better. You could also take a look at the MVC pattern and see the responsibility of each layer. Once you understand that, it would then be easier to see what qualifies as a "business object".
业务对象是域模型的元素部分。
什么是领域模型?域模型从现实世界的角度描述了您的系统的功能。领域模型描述了元素之间的逻辑关系以及它们之间的约束。
业务对象、业务实体或简单的实体在某种程度上是可互换的术语。这里指的是软件解决方案在现实世界中所代表的内容,可以是
客户端
、帐户
、文档
等。这可以是任何内容你的解决方案应该解决。这就排除了纯粹的技术对象,这些对象只是为了解决实现问题。
我们使用术语实体,因为这些元素存在于软件之外(它们确实存在)。换句话说,软件是这些元素的代表。
请参阅:
Business objects are the elements part of your domain model.
What is the domain model? The domain model describe what your system does from point of view of the real-world. The domain model describes the logical relationship between the elements and the constraint between them.
Business object, business entites, or simply entities are somehow exchangeable terms. There refer to what the software solution will represent in the real world, this can be
client
,account
,documents
, etc. This can be whatever your solution is supposed to address.This then excludes purely technical objects which are only there only to solve implementation issues.
We use the term entities, because these elements exist (they have an existence) outside of the software. In other words, the software is a representation of these elements.
See:
也许一个具体的例子可能会有所帮助。假设您正在编写一个菜单规划应用程序。这里的业务对象可能是诸如菜单、成分、用户帐户、发票之类的东西 - 这些对象封装了业务模型的逻辑。
非业务对象包括菜单表单、数据库、事务等。
Perhaps a concrete example might help. Say you're writing an menu planning application. Your business objects here would be things like Menu, Ingredient, UserAccount, Invoice - those objects that encapsulate the logic of your business model.
Things that aren't business objects would include things like MenuForm, Database, Transaction.
我仍然没有 100% 理解业务对象 (BO) 与数据传输对象 (DTO) 的区别。
在我看来,DTO 只包含数据,而 BO 包含数据和处理数据的代码?!?
那么一个BO可以“包含”多个DTO的数据,对吗?
I still do not get a 100% understanding of how business objects (BO) differ from data transfer objects (DTO).
Seems to me that DTOs contains data only, while BOs contain the data and the code to deal with the data?!?
So one BO can "contain" the data of multiple DTOs, right?
业务对象是代表业务实体并且可以选择性地包含业务逻辑的对象。
A Business Object is an object that represents business entity and optionally may contain Business Logic.