A software project layering device
By introducing a hierarchical structure of the service layer and the business layer into the software project, the problem that user needs cannot be met in multiple business scenarios is solved, and the development and testing workload is reduced.
Patent Information
- Application Number
- CN202010937223.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-08
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2040-09-08
AI Technical Summary
The existing software project hierarchy method cannot meet user needs in multiple business scenarios, resulting in R&D personnel needing to open code branches, increasing the development and testing workload.
A software project hierarchy device is adopted, including a service layer and multiple service layers. The service layer carries the packaging of basic services and general services, and the service layer orchestrates basic services and general services according to business scenarios.
Through this hierarchical structure, the increase in project branches is avoided, the development and testing workload is reduced, and the user needs in different business scenarios are met.
Smart Images

Figure CN114153423B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a software project layering device. Background Art
[0002] In the prior art, the software project layers include the control layer (Controller), the service layer (Service) and the data access object layer (DAO). However, the software project generated by this layering cannot meet the needs of users in multiple business scenarios. This is because when customers in different business scenarios have inconsistent requirements for the same function in the software project, since in the above-mentioned layering method, the codes related to the business logic are all placed in the service layer, the R&D personnel usually generate new software project branches by opening code branches to meet the user's needs. Among them, the software project branches are also suitable for the above-mentioned layering method. This practice will lead to more and more software project branches, thereby increasing the development and testing workload. Summary of the invention
[0003] The purpose of the embodiment of the present application is to provide a software project layering device to solve the problem of increased development and testing workload caused by R&D personnel generating new software project branches by opening code branches. The specific technical solution is as follows:
[0004] A software project layering device, comprising:
[0005] Service layer and multiple business layers;
[0006] The service layer is used to carry the encapsulation of basic services and general services;
[0007] The business layer is used to arrange the basic services and the common services according to the business scenarios of the software project application, wherein the business scenarios correspond to the business layers one by one.
[0008] Preferably, the service layer includes:
[0009] Data transmission object entity layer and service interface layer;
[0010] The data transmission object entity layer is used to define the data structure of the basic service and the common service;
[0011] The service interface layer is used to access the basic services and the common services.
[0012] Preferably, the business layer includes:
[0013] Domain object entity layer and business interface layer;
[0014] The domain object entity layer is used to define the data structure of business layer data, and the business layer data includes business domain data, and the business domain data is obtained by arranging the basic service and the common service;
[0015] The business interface layer is used to access the business layer data.
[0016] Preferably, it also includes:
[0017] The persistence layer is used to carry the abstraction of business data access, and the business data includes database data and cache data.
[0018] Preferably, the persistence layer includes:
[0019] Data access object layer, cache layer and aggregation layer;
[0020] The data access object layer is used to carry the abstraction of the database data access;
[0021] The cache layer is used to carry the abstraction of cache data access;
[0022] The aggregation layer is used to carry out the encapsulation of consistency between the database data and the cache data.
[0023] Preferably,
[0024] The data access object layer includes a data object entity and a first access interface layer, wherein the data object entity corresponds one-to-one to a data table in the database, and the first access interface layer is used to access the database data;
[0025] The cache layer comprises a cache entity layer and a second access interface layer, wherein the cache entity layer is used to define the data structure of the cache data, and the second access interface layer is used to access the cache data;
[0026] The aggregation layer includes an aggregation entity layer and a third access interface layer, wherein the aggregation entity layer is used to define a data structure of data written into a database and the cache at the same time, and the third access interface layer is used to access the database and the cache.
[0027] Preferably, it also includes:
[0028] The external layer is used to realize entity conversion between different business layers.
[0029] Preferably, the outer layer comprises:
[0030] An application layer provided to the front-end page for access, used to carry a representational state transition interface, wherein the representational state transition interface is used to implement the entity conversion according to a trigger instruction received from a predetermined page;
[0031] and / or
[0032] The application program interface layer is used to define a remote procedure call interface, and the remote procedure call interface is used to implement the entity conversion.
[0033] Preferably,
[0034] The application layer includes a value object entity layer and a control interface layer, wherein the value object entity layer is used to encapsulate the data of the predetermined page, and the control interface layer is used to call the domain object entities of the different business layers and convert the domain object entities into the object entities;
[0035] The application interface layer includes a data transmission object entity layer and an application interface layer. The data transmission object entity layer carries the abstraction of entity conversion from domain object entities of different business layers to the object entities. The application interface layer is used to realize data transmission between the business layer.
[0036] Preferably:
[0037] The common layer is used to receive calls from the persistence layer, the service layer and the business layer to implement preset common logic processing.
[0038] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:
[0039] In the solution provided by the embodiment of the present application, the codes related to the business logic are placed in the service layer and the business layer, wherein the service layer is used to carry the encapsulation of basic services and general services, and the business layer is used to arrange the service layer according to the needs of the business scenario. When customers in different business scenarios have inconsistent requirements for the same function in the software project, the basic services and general services in the service layer can be arranged by different business layers. The solution of the present application will not lead to an increase in project branches, nor will it cause an increase in the workload of development and testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 A structural diagram of a software layering device provided in an embodiment of the present application;
[0042] Figure 2 Another structural diagram of a software layering device provided in an embodiment of the present application;
[0043] Figure 3 Another structural schematic diagram of a software layering device provided in an embodiment of the present application;
[0044] Figure 4 Another structural schematic diagram of a software layering device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] The present application embodiment provides a software project layering device, such as Figure 1 As shown, the device comprises:
[0047] The service layer 100 and the business layer 110 .
[0048] The service layer 100 is used to carry the encapsulation of basic services and common services.
[0049] Preferably, the service layer 100 includes:
[0050] Data Transfer Object (DTO) layer and service interface layer.
[0051] The data transfer object entity layer is used to define the data structure of basic services and common services.
[0052] Service interface layer, used to access basic services and common services.
[0053] The basic services include services for repackaging the persistence layer for accessing business data and services for repackaging the Remote Procedure Call (RPC) interface.
[0054] Common services include services that rely on third-party middleware for encapsulation, such as obtaining self-incrementing identification (ID) services through distributed coordination technology (zookeeper).
[0055] In actual applications, the implementation forms of basic services and common services include one or more of the following:
[0056] Credit limit adjustment service; account handling service; log service; flow control service; authentication service;
[0057] Accordingly, the data structure of basic services and common services can be:
[0058] In one example, for a credit limit adjustment service, the data structure of the object to be passed into the credit limit adjustment method of the credit limit adjustment service may be an identity card number, credit limit adjustment amount, and the like.
[0059] Specifically, when the software project is applied to a bank's business scenario, the adjustment limit may be the credit limit corresponding to the ID card number.
[0060] In one example, for an account handling service, the data structure of the object that needs to be passed into the handling method of the account handling service may be an ID card number, account status, etc.
[0061] In one example, for a log service, the data structure of the object to be passed into the log recording method of the log service may be the log generation time, log content, and the like.
[0062] In one example, for a current limiting service, the data structure of the object that needs to be passed into the current limiting method of the current limiting service may be a current limiting key (Key), a current limiting size, and the like.
[0063] In one example, for an authentication service, the data structure of the object to be passed into the authentication method of the authentication service may be a token, a key, and the like.
[0064] As an embodiment, the service interface layer includes a service interface abstract definition layer and a service interface specific implementation layer.
[0065] Among them, the service interface abstract definition layer defines the abstract interface used by the service layer; the service interface specific implementation layer encapsulates the specific implementation of the service layer interface.
[0066] In actual applications, the definition layer of the service interface abstraction includes one or more of the following in its specific implementation:
[0067] The abstract definition of the adjustment method of the adjustment service;
[0068] Abstract definition of the disposal method of the account disposal service;
[0069] Abstract definition of the logging method of the log service;
[0070] Abstract definition of the current limiting method of the current limiting service;
[0071] Abstract definition of the authentication method of the authentication service.
[0072] In actual applications, the service interface implementation layer includes one or more of the following:
[0073] Specific implementation of the quota adjustment method of the quota adjustment service;
[0074] Specific implementation of the disposal method of the account disposal service;
[0075] The specific implementation of the log service's log recording method calls the log data persistence layer interface to complete the persistence of log data;
[0076] The specific implementation of the current limiting method of the current limiting service is to implement current limiting through the current limiting algorithm and to complete the persistence of the current limiting data through the interface of the current limiting data persistence layer;
[0077] The specific implementation of the authentication method of the authentication service is to complete the persistence of the authentication data through the interface of the authentication data persistence layer.
[0078] The business layer 110 is used to orchestrate basic services and common services according to the business scenarios of software project applications.
[0079] Among them, there are multiple business layers, and business scenarios correspond one to one with business layers.
[0080] The software project in this embodiment can be applied to different business scenarios, such as banking business scenarios, insurance business scenarios, etc. Different business scenarios correspond to different business layers. When customers in different business scenarios have inconsistent requirements for the same function in the software project, the basic services and general services in the service layer can be implemented through different business layer orchestration services.
[0081] When a software project is exported, the same functional module often appears. Due to the different requirements of different business scenarios, the code logic of the module varies from customer to customer. In order to be compatible with such different logics, developers usually open a new branch. As such requirements increase, there will be more and more branches in the software project. Once a certain requirement appears in the software project: a new function needs to be added to each business scenario, the developers and testers will become very frustrated. They need to pull down all the branches for modification, and then test each branch and put it online. The workload is very huge.
[0082] Opening a business layer for customers in each business scenario can solve the above problems well without increasing the number of project branches, and the development and testing workload will be significantly reduced.
[0083] In actual application, Maven profile is used to control the output of different business layer modules to customers in different business scenarios, as shown below:
[0084]
[0085] Preferably, the business layer 110 includes:
[0086] Domain object entity layer and business interface layer;
[0087] The domain object entity layer is used to define the data structure of business layer data, which includes business domain data, and the business domain data is obtained by arranging basic services and common services;
[0088] The business interface layer is used to access the business layer data.
[0089] In actual applications, business layer data may include quota adjustment business data (quota), account disposal business data (account) and external interface business data.
[0090] In actual business, the business interface layer includes the business interface definition layer and the business interface implementation layer.
[0091] When the business layer data is the data of the quota adjustment business, the domain object entity layer defines the data structure of the object that needs to be passed in to access the quota adjustment business interface;
[0092] The business interface definition layer defines the abstract interface used by the quota adjustment business;
[0093] The business interface implementation layer encapsulates the specific implementation of the quota adjustment business interface.
[0094] As an example, the data structure of the object that needs to be passed in when accessing the credit limit adjustment business interface may be: ID card number, credit limit adjustment amount, etc.
[0095] The business interface is defined as the quota adjustment method of the quota adjustment interface;
[0096] The specific implementation of the quota adjustment method of the quota adjustment interface, such as: arranging the three services of the service layer, namely "current limiting service", "quota adjustment service" and "log service" together to form a specific implementation of the quota adjustment interface.
[0097] When the business layer data is account handling business data, the domain object entity layer defines the data structure of the object that needs to be passed in to access the account handling business interface;
[0098] The business interface definition layer defines the abstract interface used for account handling business;
[0099] The business interface implementation layer encapsulates the specific implementation of the account handling business interface.
[0100] As an example, the data structure of the object that needs to be passed in to access the account handling business interface can be ID number, account status, adjustment status, etc.
[0101] The business interface is defined as the disposal method of the account disposal interface;
[0102] The specific implementation of the disposal method of the account disposal interface, such as: arranging the three services of the service layer "current limiting service", "account disposal service", and "log service" together to form a specific implementation of the account disposal interface. When the business layer data is the data of the external interface business, the business interface layer includes the business interface implementation layer, in which the business interface implementation encapsulates the specific implementation of the external business interface, for example, the specific implementation of the calling method of "external system calling the current system interface", such as: arranging the four services of the service layer "authentication service", "current limiting service", "account disposal service", and "log service" together to form a specific implementation of "external system calling the current system interface".
[0103] In actual applications, each business layer defines the business interface and its implementation class. Each business layer arranges the basic services and common services of the service layer according to the business logic through coding.
[0104] In other embodiments of the present application, when the business scenario applied by the software project is relatively simple, such as the software project only applies one business scenario, the business layer and the service layer can be merged and only the business layer is retained. At this time, the business layer has only one layer, and the basic services and common services are encapsulated in the business layer, and the business layer orchestrates the basic services and common services according to the business scenario.
[0105] The present application embodiment provides another software project layering device, such as Figure 2 As shown, the device comprises:
[0106] Service layer 200 , business layer 210 , persistence layer 220 , external layer 230 and public layer 240 .
[0107] in:
[0108] The service layer 200 is used to carry the encapsulation of basic services and general services.
[0109] Preferably, the service layer 200 includes:
[0110] Data Transfer Object (DTO) layer and service layer interface layer.
[0111] The data transfer object entity layer is used to define the data structure of basic services and common services.
[0112] Service layer interface layer, used to access basic services and common services.
[0113] The basic services include services for repackaging the persistence layer for accessing business data and services for repackaging the Remote Procedure Call (RPC) interface.
[0114] Common services include services that rely on third-party middleware for encapsulation, such as obtaining self-incrementing identification (ID) services through distributed coordination technology (zookeeper).
[0115] In actual applications, the implementation forms of basic services and common services include one or more of the following:
[0116] Credit limit adjustment service; account handling service; log service; flow control service; authentication service;
[0117] Accordingly, the data structure of basic services and common services can be:
[0118] In one example, for a credit limit adjustment service, the data structure of the object to be passed into the credit limit adjustment method of the credit limit adjustment service may be an identity card number, credit limit adjustment amount, and the like.
[0119] Specifically, when the software project is applied to a bank's business scenario, the adjustment limit may be the credit limit corresponding to the ID card number.
[0120] In one example, for an account handling service, the data structure of the object that needs to be passed into the handling method of the account handling service may be an ID card number, account status, etc.
[0121] In one example, for a log service, the data structure of the object to be passed into the log recording method of the log service may be the log generation time, log content, and the like.
[0122] In one example, for a current limiting service, the data structure of the object that needs to be passed into the current limiting method of the current limiting service may be a current limiting key (Key), a current limiting size, and the like.
[0123] In one example, for an authentication service, the data structure of the object to be passed into the authentication method of the authentication service may be a token, a key, and the like.
[0124] As an embodiment, the service interface layer includes a service interface abstract definition layer and a service interface specific implementation layer.
[0125] Among them, the service interface abstract definition layer defines the abstract interface used by the service layer, and the abstract interface is used to access basic services and common services; the service interface specific implementation layer encapsulates the specific implementation of the service layer interface, and the interface corresponds one-to-one with the abstract interface.
[0126] In actual applications, the definition layer of the service interface abstraction includes one or more of the following in its specific implementation:
[0127] The abstract definition of the adjustment method of the adjustment service;
[0128] Abstract definition of the disposal method of the account disposal service;
[0129] Abstract definition of the logging method of the log service;
[0130] Abstract definition of the current limiting method of the current limiting service;
[0131] Abstract definition of the authentication method of the authentication service.
[0132] In actual applications, the service interface implementation layer includes one or more of the following:
[0133] Specific implementation of the quota adjustment method of the quota adjustment service;
[0134] Specific implementation of the disposal method of the account disposal service;
[0135] The specific implementation of the log service's log recording method calls the log data persistence layer interface to complete the persistence of log data;
[0136] The specific implementation of the current limiting method of the current limiting service is to implement current limiting through the current limiting algorithm and to complete the persistence of the current limiting data through the interface of the current limiting data persistence layer;
[0137] The specific implementation of the authentication method of the authentication service is to complete the persistence of the authentication data through the interface of the authentication data persistence layer.
[0138] The business layer 210 is used to arrange basic services and common services according to the business scenarios of the software project application, wherein the business scenarios correspond one to one with the business layers.
[0139] The software project in this embodiment can be applied to different business scenarios, such as banking business scenarios, insurance business scenarios, etc. Different business scenarios correspond to different business layers. When customers in different business scenarios have inconsistent requirements for the same function in the software project, the basic services and general services in the service layer can be implemented through different business layer orchestration services.
[0140] When a software project is exported, the same functional module often appears. Due to the different requirements of different business scenarios, the code logic of the module varies from customer to customer. In order to be compatible with such different logics, developers usually open a new branch. As such requirements increase, there will be more and more branches in the software project. Once a certain requirement appears in the software project: a new function needs to be added to each business scenario, the developers and testers will become very frustrated. They need to pull down all the branches for modification, and then test each branch and put it online. The workload is very huge.
[0141] Opening a business layer for customers in each business scenario can solve the above problems well without increasing the number of project branches, and the development and testing workload will be significantly reduced.
[0142] In actual application, Maven profile is used to control the output of different business layer modules to customers in different business scenarios, as shown below:
[0143]
[0144] Preferably, the business layer 110 includes:
[0145] Domain object entity layer and business interface layer;
[0146] The domain object entity layer is used to define the data structure of business layer data, which includes business domain data, and the business domain data is obtained by arranging basic services and common services;
[0147] The business interface layer is used to access the business layer data.
[0148] In actual applications, business layer data may include quota adjustment business data (quota), account disposal business data (account) and external interface business data.
[0149] In actual business, the business interface layer includes the business interface definition layer and the business interface implementation layer.
[0150] When the business layer data is the data of the quota adjustment business, the domain object entity layer defines the data structure of the object that needs to be passed in to access the quota adjustment business interface;
[0151] The business interface definition layer defines the abstract interface used by the quota adjustment business;
[0152] The business interface implementation layer encapsulates the specific implementation of the quota adjustment business interface.
[0153] As an example, the data structure of the object that needs to be passed in when accessing the credit limit adjustment business interface may be: ID card number, credit limit adjustment amount, etc.
[0154] The business interface is defined as the quota adjustment method of the quota adjustment interface;
[0155] The specific implementation of the quota adjustment method of the quota adjustment interface, such as: arranging the three services of the service layer, namely "current limiting service", "quota adjustment service" and "log service" together to form a specific implementation of the quota adjustment interface.
[0156] When the business layer data is account handling business data, the domain object entity layer defines the data structure of the object that needs to be passed in to access the account handling business interface;
[0157] The business interface definition layer defines the abstract interface used for account handling business;
[0158] The business interface implementation layer encapsulates the specific implementation of the account handling business interface.
[0159] As an example, the data structure of the object that needs to be passed in to access the account handling business interface can be ID number, account status, adjustment status, etc.
[0160] The business interface is defined as the disposal method of the account disposal interface;
[0161] The specific implementation of the disposal method of the account disposal interface, such as: arranging the three services of the service layer "current limiting service", "account disposal service", and "log service" together to form a specific implementation of the account disposal interface. When the business layer data is the data of the external interface business, the business interface layer includes the business interface implementation layer, in which the business interface implementation encapsulates the specific implementation of the external business interface, for example, the specific implementation of the calling method of "external system calling the current system interface", such as: arranging the four services of the service layer "authentication service", "current limiting service", "account disposal service", and "log service" together to form a specific implementation of "external system calling the current system interface".
[0162] In actual applications, each business layer will define business interfaces and their implementation classes. Each business layer will code and arrange the basic services and common services of the service layer according to business logic. The persistence layer 220 is used to carry the abstraction of business data access. Business data includes database data and cache data.
[0163] The persistence layer encapsulates the abstraction of business data access to storage media and provides an interface for accessing business data.
[0164] Preferably, if Figure 3 As shown, the persistence layer 220 includes:
[0165] Data Access Object (DAO) 300 , cache layer (CACHE) 310 and aggregation layer (AGGR) 320 .
[0166] The data access object layer 300 is used to carry the abstraction of database data access.
[0167] The data access object layer 300 includes a data object (Entity) entity layer and a first access interface layer, wherein the data object entity corresponds one-to-one to the data table in the database, and the first access interface layer is used to access the database data.
[0168] Since the data object entity is a mapping of the data table in the database, the relationships of the data table are mapped to the relationships of the data object entity.
[0169] The data object entity defines the data structure of the object that needs to be passed into the interface to access the persistence layer, and the object that needs to be passed into the persistence layer belongs to the database data.
[0170] As an example, the data object entity may be a data structure of an object that needs to be passed into a log storage method of a log data persistence interface, such as log generation time, log content, and the like.
[0171] The first access interface layer includes an abstract definition layer of a data persistence interface and a specific implementation layer of the data persistence interface.
[0172] Among them, the abstract definition layer of the data persistence interface defines the abstract interface used by the data persistence layer; the specific implementation layer of the data persistence interface encapsulates the specific implementation of the data persistence layer interface.
[0173] As an example, the abstract definition of the data persistence interface may be the abstract definition of the storage log method of the log data persistence interface; and the specific implementation of the data persistence interface may be the specific implementation of the storage log method of the log data persistence interface.
[0174] The cache layer 310 is used to carry the abstraction of cache data access.
[0175] The cache layer 310 includes a cache entity layer and a second access interface layer, wherein the cache entity layer is used to define the data structure of cache data, and the second access interface layer is used to access the cache data.
[0176] The cache entity layer defines the data structure of the object that needs to be passed in to the interface accessing the persistence layer. The object that needs to be passed in to the interface accessing the persistence layer belongs to the cache data.
[0177] As an example, the data structure may be a data structure of an object that needs to be passed into a storage method of a current limiting data persistence interface, such as a current limiting key, a current limiting size, and the like.
[0178] The second access interface layer includes the abstract definition of the data persistence interface and the specific implementation of the data persistence interface.
[0179] Among them, the abstract definition of the data persistence interface defines the abstract interface used by the data persistence layer; the specific implementation of the data persistence interface encapsulates the specific implementation of the data persistence layer interface.
[0180] As an example, the abstract definition of the data persistence interface may be an abstract definition of the storage method of the current-limiting data persistence interface; and the specific implementation of the data persistence interface may be a specific implementation of the storage method of the current-limiting data persistence interface.
[0181] The aggregation layer 320 is used to carry the encapsulation of database data and cache data consistency.
[0182] The aggregation layer 320 includes an aggregation entity layer and a third access interface layer, wherein the aggregation entity layer is used to define the data structure of data written into the database and the cache at the same time, and the third access interface layer is used to access the database and the cache at the same time.
[0183] In this embodiment, the layering of the persistence layer can be a dynamic abstract layered structure that changes with the needs of the business scenario. When the business scenario of the software project application is simple, that is, only a database storage medium is needed to meet the business needs, the persistence layer is implemented by the data access object layer; when the business scenario of the software project application is complex, that is, multiple storage media such as databases and caches are needed to meet the business needs, the persistence layer is implemented by the data access object layer, the cache layer, and the aggregation layer.
[0184] The external layer 230 is used to implement entity conversion between different business layers.
[0185] The external layer is also called the application layer. A software project can have multiple external layers or one external layer. The external layer does not process business logic, but is only responsible for entity conversion between the business layer and the service layer.
[0186] For the outer layer 230, such as Figure 4 As shown, including:
[0187] The application layer 400 provided to the front-end page access is used to carry the representational state transition interface, which is used to implement entity conversion according to the trigger instruction received from the predetermined page. And / or
[0188] The application program interface layer 410 is used to define a remote procedure call interface, and the remote procedure call interface is used to implement entity conversion.
[0189] The application layer 400 provided for front-end page access includes a value object entity layer and a control interface layer. The value object entity layer is used to encapsulate the data of the predetermined page, and the control interface layer is used to call domain object entities of different business layers and convert domain object entities into object entities.
[0190] The value object entity layer defines the data structure of the object that needs to be passed in to each control interface of the front-end system to access the back-end system. The object that needs to be passed in to each control interface belongs to the data that encapsulates the predetermined page.
[0191] As an example, the data structure of the object that needs to be passed in when the front-end system accesses each control interface of the back-end system may include: interface name, interface input and output parameters, etc.
[0192] The control interface layer encapsulates the specific implementation of the back-end interface that the front-end subsystem depends on. The back-end interface is used to call domain object entities of different business layers and convert domain object entities into object entities.
[0193] As an example, the specific implementation of the control interface may include how to create a new "interface" method, update the existing "interface" method, etc.
[0194] The application interface layer 410 includes a data transmission object entity layer and an application interface layer. The data transmission object entity layer carries the abstraction of entity conversion from domain object entities to object entities of different business layers, and the application interface layer is used to realize data transmission between the external layer and the business layer.
[0195] The data transmission object entity layer defines the data structure of the object to be passed in when accessing the external interface, wherein the object to be passed in the external interface is the abstraction of entity conversion from domain object entities to object entities belonging to different business layers.
[0196] As an example, the external interface needs to pass in the data structure of the object, such as: interface key, token, secret key, etc.
[0197] The application program interface layer defines the external (external) abstract interface of the current system. The external (external) abstract interface of the current system belongs to the data between the external layer and the business layer, where the current system corresponds to the business scenario of the software project.
[0198] As an example, a method of "external system calling the current system interface" is defined, such as: a method of calling the current system interface.
[0199] In other embodiments of the present application, exception handling may also be performed on the external layer, and the exceptions of the persistence layer, service layer, and business layer may be output externally.
[0200] In actual applications, exceptions include: passing in illegal parameters when calling the business layer, or writing too much data, causing the business layer or service layer to crash and cause exceptions, etc.
[0201] Exception handling process: The persistence layer throws an exception to the service layer, the service layer throws an exception to the business layer, the business layer throws an exception to the external layer, the external layer receives the exception thrown by the business layer, records the exception log, and converts the exception into an error code for external output.
[0202] The common layer 240 is used to receive calls from the persistence layer, service layer and business layer to implement preset common logic processing.
[0203] In practical applications, common logical processing includes at least string processing and date conversion.
[0204] In order to reasonably layer and optimize the code logic of the software project, the software project in the embodiment of the present application shall at least follow the following rules when outputting:
[0205] The upper layer can call the lower layer that is logically adjacent to the upper layer, and different layers cannot call each other. Logically, the persistence layer is the lowest layer, the service layer is adjacent to the persistence layer, the business layer is adjacent to the service layer, and the external layer is adjacent to the business layer.
[0206] The lower layer cannot call the upper layer;
[0207] When the preset conditions are met, the levels can call each other.
[0208] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0209] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0210] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A software project layering device, characterized in that: include: Service layer and multiple business layers; The service layer is used to carry the encapsulation of basic services and general services; The business layer is used to arrange the basic services and the common services according to the business scenarios of the software project application, wherein the business scenarios correspond to the business layers one by one; The business layer includes: a persistence layer, which is used to carry the abstraction of business data access, and the business data includes database data and cache data; the persistence layer includes: a data access object layer, a cache layer and an aggregation layer; the data access object layer is used to carry the abstraction of the database data access; the cache layer is used to carry the abstraction of the cache data access; the aggregation layer is used to carry the encapsulation of the consistency of the database data and the cache data.
2. The device according to claim 1, characterized in that The service layer includes: Data transmission object entity layer and service interface layer; The data transmission object entity layer is used to define the data structure of the basic service and the common service; The service interface layer is used to access the basic services and the common services.
3. The device according to claim 1, characterized in that The business layer also includes: Domain object entity layer and business interface layer; The domain object entity layer is used to define the data structure of business layer data, and the business layer data includes business domain data, and the business domain data is obtained by arranging the basic service and the common service; The business interface layer is used to access the business layer data.
4. The device according to claim 1, characterized in that The data access object layer includes a data object entity and a first access interface layer, wherein the data object entity corresponds one-to-one to a data table in the database, and the first access interface layer is used to access the database data; The cache layer comprises a cache entity layer and a second access interface layer, wherein the cache entity layer is used to define the data structure of the cache data, and the second access interface layer is used to access the cache data; The aggregation layer includes an aggregation entity layer and a third access interface layer, wherein the aggregation entity layer is used to define a data structure of data written into a database and the cache at the same time, and the third access interface layer is used to access the database and the cache.
5. The device according to any one of claims 3 to 4, characterized in that: Also includes: The external layer is used to realize entity conversion between different business layers.
6. The device according to claim 5, characterized in that The outer layer comprises: An application layer provided to the front-end page for access, used to carry a representational state transition interface, wherein the representational state transition interface is used to implement the entity conversion according to a trigger instruction received from a predetermined page; and / or The application program interface layer is used to define a remote procedure call interface, and the remote procedure call interface is used to implement the entity conversion.
7. The device according to claim 6, characterized in that The application layer includes a value object entity layer and a control interface layer, wherein the value object entity layer is used to encapsulate the data of the predetermined page, and the control interface layer is used to call the domain object entities of the different business layers and convert the domain object entities into the object entities; The application interface layer includes a data transmission object entity layer and an application interface layer. The data transmission object entity layer carries the abstraction of entity conversion from domain object entities of different business layers to the object entities. The application interface layer is used to realize data transmission between the business layer.
8. The device according to claim 1, characterized in that Also includes: The common layer is used to receive calls from the persistence layer, the service layer and the business layer to implement preset common logic processing.
Citation Information
Patent Citations
Metropolitan area network different-manufacturer business choreographer
CN109379217A