Concept Business in Lattice
Published: 2022-10-18 04:56:19

> [Lattice](https://dev.to/yuzhenxin/lattice-framework-introduction-28h0) is a powerful, lightweight business extension invoke framework. By using the Lattice framework, complex business customization can be efficiently organized and managed. refer: https://dev.to/yuzhenxin/lattice-framework-introduction-28h0

# What is business?

Regarding what "business" is, I believe everyone will have their own views, and some people may even think that what they do is business. Wikipedia defines business as follows:

> A business, also known as an enterprise, or a firm, is an entity involved in the provision of goods and/or services to consumers.Businesses are prevalent in capitalist economies, where most of them are privately owned and provide goods and services to customers in exchange for other goods, services, or money.

In short: "Business" is the business activity of "selling a product/service for a profit".

Since the ultimate goal of "business" is to "sell a product/service for profit". Then an enterprise's business operation activities will actually be carried out around this core theme. The difference between an idealistic and a short-sighted company is to obtain profits from sustainable development in the future industrial chain, or to obtain profits that are a little bit of profit now. Focusing on business operations, companies generally make business planning, organizational structure design, and business operations around two dimensions: how to increase profits and how to reduce costs.

Here are some examples of business units:

* Hema Business: Innovating and trying e-commerce business models, moving offline to online, combining with supermarkets to seize the market, achieving break even through economies of scale, and opening up the entire chain of fresh food supply chain, quality assurance, and timely delivery. , and establish a standard system and access threshold to achieve long-term sustainable development. is a typical business operation
* Electronic vouchers Business: Through the innovation of delivery methods, the performance of contracts has been enhanced from physical delivery to fulfillment of contracts with "codes" through electronic vouchers, which can be more suitable for similar movie tickets, tickets, offline store pickup, service performance, etc. Wait. To a certain extent, it expands the applicable market scope of e-commerce transactions, improves the efficiency of transaction performance, promotes the achievement of business, and actually increases profits. In theory, if any item is supposed to be able to provide offline voucher pickup, then all businesses can use electronic vouchers.


When a company is designing its organizational structure, it generally designs two types of business units: profit centers and cost centers. The former is more (note: not only) to consider how to obtain profits through business model innovation, market preemption, and industrial chain construction; while the cost center is more to consider how to reduce costs and improve efficiency. Increase profits with the same market size.

# Business Dimension Definition

Because of the different types of business departments, the specific business forms have different dimensions. My personal point of view is to divide the business into two dimensions: vertical and horizontal.

## Vertical Business

Regarding vertical business, it can also be another word, called industry. As the saying goes, every line is like a mountain.
Business rules and business assessments are often different or even contradictory between industries, such as:

* Auto finance business: no discount, no payment overtime for orders, but there are pre-authorization confirmation overtime requirements, no logistics, and its own special financial qualification verification mechanism, etc.
* General Taobao business: there is logistics and delivery, and the general delivery time is about 7 days; there are various marketing activities; the payment overtime is generally 1 day; it supports cash on delivery and freight insurance, etc.
* Hema business: there is no logistics, it is an offline delivery method; there are specific promotions; there is a payment overtime requirement after placing an order; in the delivery performance, there are higher real-time SLA requirements for delivery;
* ......


Business rules vary widely across industries. From the perspective of vertical business, it is inconceivable for the auto finance business to reuse the specific business rules of Ele.me.

Even if the requirements of the two industries are the same in terms of a certain business rule, such as offline delivery time, then the more appropriate approach must be: business A configures a payment timeout rule of 10 minutes in its own business space; Business B also configures a business rule with a payment timeout of 10 minutes in its own business space. Rather than reuse the same rules for the two business of A and B. Because, if business rules are reused, business A changes the timeout configuration one day, which will definitely affect business B. This is not what business B wants to see.

> Therefore, the business rules between vertical businesses are isolated from each other.

## Horizontal Business

Regarding horizontal business, the characteristic of horizontal business is that all vertical businesses can be used and superimposed. Therefore, I can also change the word for "horizontal business" and call it "platform business". Typical representatives of horizontal business are: electronic vouchers, group purchases, shopping guides, distribution.

A horizontal business (platform business) will also have its own business rule. When a business is using a certain platform, some business rules will be rewritten:

* Electronic vouchers: If the business wants to use electronic vouchers, when placing an order, the user needs to reserve a mobile phone number for voucher issuance and verification; electronic voucher products cannot enjoy freight insurance because no logistics is required;
* Group buying platform: If a business wants to be listed on our group buying platform, the price of commodities must be discounted and cannot be sold at the original price; the payment timeout must be set within 30 minutes;
* ......


It can be seen that the horizontal business will change some existing business rules of the vertical business. Moreover, in contrast to the feature that vertical services cannot be superimposed, there may be superimposition among multiple horizontal services. For example, businesses that use electronic vouchers also allow group purchases; businesses that use group purchases also allow distribution platforms. so:

> Horizontal business is a change to vertical business rules

> Multiple horizontal businesses can be superimposed on the same vertical business

Why do vertical businesses receive platform business adjustments to their business rules? Obviously, through these platform businesses, the business can have more ways to play, promote sales (increase profits), bring users a better experience, and so on. Therefore, in the face of the rules and requirements of the platform, it can also be compromised and accepted.

> Therefore, for a business, the complete business rule set related to it is composed of a vertical business rule set + N horizontal business rule sets.

If you can understand the above inference, it is not difficult to understand how the Lattice framework manages and manages multiple custom logics for business extension points.


# Conflict of vertical business overlaying horizontal business

Since multiple horizontal businesses can be superimposed on the same vertical business, what if there is a conflict at the same business point? Here are some small examples.

## An example of reduce mode conflict resolution

For an example of the quantity that can be purchased: 
1. Assume that the rule of a vertical business is that the purchase quantity cannot exceed the number of stocks
2. But after superimposing the electronic voucher business, the electronic voucher business requires that the maximum number of purchases cannot exceed 250
3. The definition of the spike business 's business rules, you can buy no more than 10 ultra-low specials

For a point, when generating multiple business rule declarations, what we need to do is to formulate a conflicting priority rule and reduce method. For this example, simply, the three rules have no particular priority requirements. It is only necessary to formulate a reduce method, whichever value is the smallest, whichever value is used.

## An exclusive contradictory business rule

As another example, a group buying platform requires that in some cases, the prices of these products ordered through the platform must be discounted. However, there may be a certain business A that is very strong. His business rule is that his commodity prices will not only not be discounted, but will also be higher than the original price, but will be lower than the market premium.

Who has the final say in this conflict of rules? In fact, the owner of the vertical business and the owner of the platform business, the two bosses can negotiate. There is no need for the program to be hard-coded. After all, the business side has its own appeal and its rationality.

For conflicts in business rules, you can formulate conflict priority rules, which are determined by the business owner. In the case of conflicts, whether the rules of the vertical business have higher priority or the priority of the vertical business.

Therefore, for the superposition of vertical business and horizontal business, when business rules conflict occurs, our solution mode is reduce algorithm + conflict priority rule

For an introduction to the types of reduce patterns that conflict with business rules after business overlay, see: [Reduce Strategy](https://github.com/hiforce/lattice/wiki/Reduce-Strategy)

***
中文版：https://www.ryu.xin/2021/08/20/lattice-concept-business/