Method of dividing system and business engineering
How to divide a system of source program engineering? This paper presents a system-and-business-based engineering partitioning model, which is characterized by distinguishing between what is 系统工程
and what is 业务工程
.
This article focuses only on the client page layer, it is not difficult to figure out the project structure of the service side after the page layer. For ease of writing, we designed a scene: A call center system running files and calling two businesses.
Interface Layer
Let's take a look at what source programs are in the interface layer, and the dependencies between them, as follows:
The above cc-ui-core
and cc-ui
is two 系统工程
, file-ui
is about the file 业务工程
, ic-ui
is about the call 业务工程
. The dependencies between these projects are shown in the arrow direction.
The engineering model has the following characteristics:
- A system has two types of systems and business engineering.
- Each system is divided into two systems engineering
ui-core
ui
, of which the ui-core
project is dependent on the business engineering, and the ui
project relies on other business projects.
- There is no dependency between business projects. A business page does not depend on another business's page, but the same kind of business can be (one-way) dependent on the page.
- There is no bidirectional or cyclic dependency between the projects.
Let's take a look at which problem the model solves.
System Sessions
After the user logs in, the system determines the current user's working environment information, which we call it 系统会话
. For example, when a user logs in to a call center, the system session saves the user 呼叫中心ID
. When a user is doing business for a customer, the system session acts as a working environment for the processing business. As an example of a call center, the fields in the business record 呼叫中心ID
should not be required or allowed to be entered in the business interface.
Therefore, we put the system session in the cc-ui-core
project, and let each 业务工程
through dependency can access to the system session object.
Page integration
There are at least two kinds of integrated scenarios.
- Menu and Tool bar. For example, when you click a menu, open a business page. This requires the menu to be dependent on the business page.
- Cross-business pages. For example, there is a page in the call center system that displays the number of files on the same day and how many calls were processed. At this point we should develop this page independently.
We put these integration pages in the cc-ui
project, which can be built through dependency cc-ui-core
acquisition to a system session and loading the corresponding page by relying on various business projects.
Data integration
As mentioned above, two business projects are not dependent on each other. But the page needs are flexible, for example, we need to open the customer profile in the call page, how to open it?
Opening another page requires some information about the new page, but since we don't allow two business projects to have dependencies, we can make a transition when we meet this requirement ui-core
. For example, suppose you want to open a page to get to it class
, and we do not want to get through reflection, at this point we can be done by interface and dependency injection, as follows:
cc-ui-core
build an interface in the project:
public interface Provider { Class<?> filePageClass();}
cc-ui
implement the interface in the project. Because cc-ui
it relies on all business engineering, it is easy to get the information you need.
ic-ui
Engineering relies on ui-core
engineering, so the interface can be obtained through dependency injection, and then the method of invoking the interface to obtain the required information.
Summarize
The engineering model we put forward can be summed up in such a sentence that the business runs in the system. The system is responsible for loading the business page, on the other hand, through the transmission System Session auxiliary business page development.
Method of dividing system and business engineering