什么是业务对象以及什么是业务逻辑?

发布于 2024-09-10 23:39:17 字数 139 浏览 9 评论 0原文

在阅读时,我不断看到对他们所谓的“业务对象”的引用。我查过维基百科等,但我一直不明白业务对象是什么。

对于不了解软件架构等知识的人来说,有什么简单的解释吗?

另外,什么是业务逻辑

When reading, I keep seeing references to what they call Business Objects. I've looked up on Wikipedia and such but I keep not getting what a Business Object is.

Is there any easy explanation of what it is for someone that doesn't know a thing about software architecture and such?

Also, what is Business Logic?

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

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

发布评论

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

评论(7

我早已燃尽 2024-09-17 23:39:17

这很容易

系统中的每个实体(代表系统期望与之交互的人类世界对象)都是业务对象。

系统中围绕操作业务对象的人类世界逻辑是业务逻辑。

这与作为实现细节一部分的对象和逻辑相反。

例如,在多层交易系统中,订单/交易将是业务对象,但心跳将是实现细节。

为流式传输对订单/交易对象进行编码的逻辑将是实现细节,而一旦交易到达将订单状态更改为“已完成”的逻辑是业务逻辑。

This is easy

Every entity in the system, representing the human-world object which the system is expected to interact with is a business object.

The human-world logic in the system around manipulating business objects is a business logic.

This is opposed to the objects and logic being part of the implementation details.

For example in the multi-tier trading system order/trade will be business objects, but heartbeat will be implementation detail.

The logic of encoding order/trade objects for streaming will be implementation detail, while the logic of changing the order state to 'completed' once trade arrives is a business logic.

别再吹冷风 2024-09-17 23:39:17

嗯,业务对象通常被认为是代表实体的类,例如一本书或一家商店。这样的类具有某些属性,如价格、颜色、宽度、isbn 编号等。在 Java 或 .NET 中,它由所谓的 setter 和 getter 组成,即设置或获取这些属性的方法。

另一方面,业务逻辑是处理该属性的程序的一部分,即这本书如何销售。业务逻辑层使用业务对象来访问数据库。

Well, a Business Object is generally considered to be a class that represents an Entity, e.g. a Book or a Store. Such a class has certain properties like price, colour, width, isbn number etc. In Java or .NET, it consists of so-called setters and getters, i.e. methods that set or get those properies.

The Business Logic on the other hand is that part of a program that works with that properties, i.e. how is this book sold. The business logic layer uses the business objects in order to access the database.

七禾 2024-09-17 23:39:17

嘿,吞噬,当我开始开发时,我也遇到了这个术语的麻烦。

基本上,使用“商业”一词的唯一原因是该术语是在商业软件的背景下开发的。因此,从这个意义上说,假设该软件是为了商业目的而构建的……而不是艺术、美学或创意目的。

因此,业务对象是现实世界“业务”对象的简单代码表示。因此,您可能有一个产品类别或一个员工类别。

业务逻辑是应用程序内特定于软件设计的“业务”的逻辑。所以,诸如税收计算之类的事情,或者产品如何与客户相关……之类的事情。

请注意,业务对象或业务逻辑的想法不适用于视频游戏开发或艺术开发。

它也不适用于某些框架或库,例如 ORMS 或单元测试库,因为它们是可重用的组件,不特定于任何“业务”。

hey devoured, I had trouble with this terminology when I started developing too.

Basically, the only reason the word "business" is used, is because the terminology developed within the context of commercial software. So in this sense, it is assumed that the software is been built for business purposes... as opposed to say, artistic, aesthetic, or creative purposes.

So, business objects are simple code representation of real world "business" objects. So, you might have a Product Class, or a Employee Class.

Business logic, is logic within the application that is specific to the "business" the software was designed for. So, things like tax calculations, or how products related to customers... that kind of thing.

Note that the idea of Business objects or Business logic would not apply to video game development, or artistic development.

It also wouldn't apply to some frameworks, or libraires, like ORMS or unit testing libraries, as an example, because they are reusable components which are not specific to any "business".

倾听心声的旋律 2024-09-17 23:39:17

在传统的三层编程中,您具有三个逻辑层。您有一个表示层,即用户界面,底层是数据库层。中间层是业务对象层。正如上面所指出的,业务对象应该被抽象,因为站点可能根本与业务无关。它是一个抽象层,可以更轻松地更改表示层或切换到不同的数据源。

如果您的用户界面级别背后没有或很少有代码。它使设计人员更容易与程序员合作。设计人员可以更改网站的外观和感觉,而程序员无需对使该网站正常工作的代码进行大量重写。通过业务对象层,您可以完成站点的大量列表。您可以调用数据库层,而业务对象不知道您的数据库层是 XML 还是关系数据库。然后业务对象层将更新对 UI 层的响应。
通常使用的示例是银行交易。在用户界面中,客户输入他想要从他的储蓄账户转入他的支票账户的金额。

业务对象层将包含银行的业务规则。这意味着它将检查用户储蓄账户的余额,并确保转账金额不超过账户余额。业务层将包含实际计算储蓄帐户和支票帐户新余额的类,并将提醒数据库层更新数据库。

In traditional 3 tier programming you have three logical layers or tiers. You have a presentation layer which is the User Interface, the bottom layer would be the database layer. The middle layer would be the business objects layer. As pointed out above the business objects should be abstracted in that the site might not be about business at all. It is a layer of abstraction that makes it easier to make changes to the presentation layer or to switch to a different data source.

If your user interface level has no or very little code behind it. It makes it easier for designers to work with programmers. The designers can change the look and feel of the site without the programmers having to do a substantial rewrite of the code that makes that site work. With the business objects layer you do the heavy listing of the site. You make calls into the database layer without the business object knowing whether your database layer is in XML or relational database. And the business object layer then would update a response to the UI layer.
Typically the example used is for a bank transaction. In the user interface a client enters the amount he would like to transfer from his savings account to his checking account.

The business object layer will contain the business rules for the bank . That means it will check the balance of the users savings account and make sure the amount to transfer does not exceed the balance of the account. The business layer will contain the classes that actually calculate the new balances for both the savings account and the checking account and it will alert the database layer to update the database.

ゝ偶尔ゞ 2024-09-17 23:39:17

业务对象:

class User {
    long id;
    String fullNames;
    int age;
}

class Book {
    long id;
    String bookTitle;
}

class Sales {
    long id;
    long userID;
    long bookID;
}

业务逻辑:

class BookSalesController {
    private User user = new User();
    private Book book = new Book();
    private Sales sale = null;

    public Sale sale(long saleID) {
        String query = "SELECT * FROM Sales s WHERE s.id = :saleID";
        ....
        .... execute the query

        // Assuming we have our Result Set here by now

        if (rs.next()) {
            sale = new Sales(rs.getString("User Names"));
            sale.setUserID(rs.getLong(userID));
            sale.setBookID(rs.getLong(bookID));
        }

        return sale;
    }
}

Business Object:

class User {
    long id;
    String fullNames;
    int age;
}

class Book {
    long id;
    String bookTitle;
}

class Sales {
    long id;
    long userID;
    long bookID;
}

Business Logic:

class BookSalesController {
    private User user = new User();
    private Book book = new Book();
    private Sales sale = null;

    public Sale sale(long saleID) {
        String query = "SELECT * FROM Sales s WHERE s.id = :saleID";
        ....
        .... execute the query

        // Assuming we have our Result Set here by now

        if (rs.next()) {
            sale = new Sales(rs.getString("User Names"));
            sale.setUserID(rs.getLong(userID));
            sale.setBookID(rs.getLong(bookID));
        }

        return sale;
    }
}
oО清风挽发oО 2024-09-17 23:39:17

业务对象的定义很难在搜索引擎上找到,因为它会告诉您 Business Objects 是一家被 SAP 收购的公司。但这并不是大多数人所寻求的。

业务对象是业务逻辑模型和业务场景的封装。

例如:在采购领域:有一个需要执行的活动的完整列表。
从支出分析到产品信息请求,再到生成协商条款的合同。因此,在这个特定场景中,像 RFI(信息请求)这样的文档可以被视为 RFI 业务对象的实例(它将具有与验证等流程相关的所有逻辑)。

A definition of a business object is difficult to get on the search engine as it will tell you that Business Objects is a company acquired by SAP. But that is not what most people look for.

A business object is the the encapsulation of business logic model a business scenario.

For eg: In procurement domain : there is a whole list of activities that need to be performed.
From Spend Analysis to Requesting of Information for the products to Generating the contract for the negotiated term. So in this particular scenario , a document like RFI (Request for information ) can be considered to be a instance of a RFI Business Object (It will have all the logic related to process like validation etc).

昇り龍 2024-09-17 23:39:17

SAP系列业务对象与oracle核心设计模式中与应用服务层交互的业务对象不同...是的,业务对象确实与复合实体一起工作,但它具有业务逻辑,它可以承载业务状态,一些简单调整方法,它们是业务信息的载体,具有可交换的动态性和跨应用层或域的能力,但在不同的上下文中,它有不同的详细指定名称,例如,我们可以说Web服务请求是一个xml格式的业务对象...它与数据实体不同

SAP series business object is different with the business object inside the oracle'core design pattern which interact with application service layer ... yes, business object does work with composite entity , but it has business logic , it can carry business state , some easy adjust methods and they are business info carrier with exchangeable the dynamic states and cross among application tiers or domains , but when at different context , it has different detailed specified name , for example, we can say web service request is a business object in xml format ...it is not the same as data entity

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