CN111414152B - Method, system, readable medium and electronic device for realizing business logic - Google Patents

Method, system, readable medium and electronic device for realizing business logic Download PDF

Info

Publication number
CN111414152B
CN111414152B CN202010220411.7A CN202010220411A CN111414152B CN 111414152 B CN111414152 B CN 111414152B CN 202010220411 A CN202010220411 A CN 202010220411A CN 111414152 B CN111414152 B CN 111414152B
Authority
CN
China
Prior art keywords
target
functional component
data
business logic
control instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010220411.7A
Other languages
Chinese (zh)
Other versions
CN111414152A (en
Inventor
周新力
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010220411.7A priority Critical patent/CN111414152B/en
Publication of CN111414152A publication Critical patent/CN111414152A/en
Application granted granted Critical
Publication of CN111414152B publication Critical patent/CN111414152B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30094Condition code generation, e.g. Carry, Zero flag
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The present disclosure relates to a method, a system, a readable medium and an electronic device for implementing service logic, and relates to the technical field of electronic information, where the method includes: registering a target functional component in a data context corresponding to the total business logic, wherein the target functional component comprises target business logic and target shared data corresponding to the target business logic, the total business logic comprises target business logic, a first control instruction is sent to the target functional component by using the data context through the first functional component, so that the target functional component executes the first control instruction according to the target business logic, first result data of the target functional component executing the first control instruction is obtained by using the data context through the first functional component, the first result data belongs to the target shared data, and the first functional component comprises the first business logic. According to the method and the device, the interoperation among the functional components is realized through the data context, the functional components are managed uniformly, and the realization efficiency and stability are improved.

Description

Method, system, readable medium and electronic device for realizing business logic
Technical Field
The present disclosure relates to the field of electronic information technology, and in particular, to a method, a system, a readable medium, and an electronic device for implementing service logic.
Background
With the continuous development of electronic information technology, the functions that can be implemented by application software are more and more complex, and the application software generally includes a plurality of functional components to implement different business logic included in the total business logic, for example: taking live broadcast software as an example, the live broadcast software comprises an audio and video function component, a gift function component, a PK function component, a barrage function component and the like. Coordinated operation is needed among all functional components to realize the total business logic. In general, communication between each functional component is realized based on an architecture of an event bus (english: eventBus), and the global event bus is used as a channel for data sharing, any functional component can issue an event to the event bus, and then the event bus broadcasts the event in an application program, and other functional components monitor the event bus in an observer mode and receive the content therein.
However, in the architecture of the event bus, each functional component can only passively receive data from the event bus, so that it is difficult to implement interoperability between complex cross-functional components, and the event bus is unidirectional communication, and the functional component that issues an event cannot know which functional components the event is received, and cannot know whether the event is processed, so that when implementing the overall business logic, the implementation efficiency and reliability are low.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a method for implementing service logic, where the method includes:
registering a target functional component in a data context corresponding to a total business logic, wherein the target functional component comprises target business logic and target shared data corresponding to the target business logic, and the total business logic comprises the target business logic;
transmitting a first control instruction to the target functional component by using the data context through the first functional component so that the target functional component executes the first control instruction according to the target business logic;
acquiring, by the first functional component, first result data of the target functional component executing the first control instruction by using the data context, where the first result data belongs to the target shared data; the first functional component comprises first business logic, and the first business logic is any business logic except the target business logic in the total business logic.
In a second aspect, the present disclosure provides a system for implementing business logic, the system comprising: the data context, the target functional component and the first functional component corresponding to the total business logic; the target functional component comprises target service logic and target shared data corresponding to the target service logic, the total service logic comprises the target service logic, the first functional component comprises first service logic, and the first service logic is any service logic except the target service logic in the total service logic;
the data context is used for registering the target functional component;
the first functional component is used for sending a first control instruction to the target functional component through the data context so that the target functional component executes the first control instruction according to the target business logic;
the first functional component is configured to obtain, through the data context, first result data of the target functional component for executing the first control instruction, where the first result data belongs to the target shared data.
Through the technical scheme, the target functional component is registered in the data context corresponding to the total business logic, wherein the target functional component comprises target business logic and target shared data corresponding to the target business logic, and the target business logic belongs to the total business logic. And the first functional component acquires first result data of the first control instruction executed by the target functional component by using the data context, wherein the first result data belongs to target shared data. The method and the device realize the interoperation among all the functional components in the total business logic by setting the data context of the total business logic, and can uniformly manage all the functional components, so that the structure of the total business logic is convenient to manage, and the realization efficiency and the stability of the total business logic are improved.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
In the drawings:
FIG. 1 is a flow chart illustrating a method of implementing business logic according to an exemplary embodiment;
FIG. 2 is a flow chart illustrating another method of implementing business logic according to an exemplary embodiment;
FIG. 3 is an architectural diagram between a first functional component, a target functional component, and a data context;
FIG. 4 is a flow chart illustrating another method of implementing business logic according to an exemplary embodiment;
FIG. 5 is a flow chart illustrating another method of implementing business logic according to an exemplary embodiment;
FIG. 6 is a flowchart illustrating another method of implementing business logic, according to an example embodiment;
FIG. 7 is a flowchart illustrating another implementation of business logic, according to an example embodiment;
FIG. 8 is a schematic diagram of an implementation system of business logic, shown in accordance with an exemplary embodiment;
fig. 9 is a schematic diagram of an electronic device according to an exemplary embodiment.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
FIG. 1 is a flow chart illustrating a method of implementing business logic, as shown in FIG. 1, according to an exemplary embodiment, the method comprising:
in step 101, registering a target functional component in a data context corresponding to the total business logic, where the target functional component includes a target business logic and target shared data corresponding to the target business logic, and the total business logic includes the target business logic.
For example, in the process of developing an application program, a data context may be first established for the total service logic, for example, an ADataContext class may be first defined as a data context according to the total service logic, and the ADataContext class inherits from the DataContext. The target functional component is then registered in ADataContext. The total business logic may be understood as the overall business logic to be implemented by the application program, and may include a plurality of business logics, and the target business logic may be any business logic in the total business logic. The target functional component may be understood as a functional component for implementing the target business logic, including code for implementing the target business logic, and may include target shared data in the target business logic that is capable of being shared with external devices (e.g., business logic other than the target business logic), and other business logic in the overall business logic may access the target shared data through the data context. Specifically, a plurality of placeholders can be set in the ADataContext, and the placeholders matched with the types of the target functional components are bound, so that the registration of the target functional components is realized. The placeholder is used for specifying the specification of the target functional component, and the target functional component is matched with the placeholder, so that the data type of the placeholder is the same as the data type of the target shared data of the target functional component, wherein the data type can comprise the type of the shared object in the target shared data and the type of the sharing method.
The target function component may inherit from the jetmackview model class, and may be classified into a variable class (MutableDataModel class) and an immutable class (DataModel class) according to whether external actions can be received, if target shared data can only be queried, the target function component is an immutable class, and if target shared data can be modified, the target function component is a mutable class.
Step 102, sending, by the first functional component, a first control instruction to the target functional component by using the data context, so that the target functional component executes the first control instruction according to the target business logic.
Step 103, obtaining, by the first functional component, first result data of the target functional component executing the first control instruction by using the data context, where the first result data belongs to the target shared data. The first functional component comprises a first business logic, wherein the first business logic is any business logic except the target business logic in the total business logic.
For example, in the total business logic, other business logic may be included in addition to the target business logic, in other business logic, the business logic that needs to operate with the target property logic may be first business logic, the first functional component is a functional component including the first business logic, and the first functional component may further include first shared data corresponding to the first business logic. The first functional component may send the first control instruction to the target functional component via the data context, and the data context may forward the first control instruction to the target functional component, so that the target functional component may execute the first control instruction according to the target business logic. A data context may be understood as an interface where the first functional component operates the target functional component, the first functional component being able to transmit the first control instruction to the target functional component via the data context only if the first control instruction complies with the rules of the target functional component, i.e. the target functional component is able to receive the first control instruction.
The target functional component may execute the first control instruction in accordance with the target business logic. Then, the data context may acquire first result data of the target functional component executing the first control instruction, and then the first functional component acquires the first result data through the data context, so that the first functional component can acquire an execution result of the first control instruction. The first result data belongs to the target sharing number, and it can be understood that only the target sharing data can be operated by the outside (for example, the first functional component) in the target functional component, so that the writing authority of the data is controlled in the target functional component, the reliability of the target functional component is improved, and a developer is not required to limit the authority of the data by writing complex codes. The first control instruction may be an operation on some object in the target shared data, or some method. For example, the first control instruction may be a query instruction, where the value of the a object (i.e., the a object state) in the target shared data is queried, and then the first result data is the current value of the a object. The first control instruction may also be an operation instruction, and the operation is that the B object in the target shared data, and then the first result data is a value after the B object executes the first control instruction.
It should be noted that, in the above embodiment, the first functional component and the target functional component are interchangeable, and a certain functional component is not specified. For example, the total business logic includes N business logic, each business logic corresponds to a functional component, the N functional components are registered in the data context, according to the specific requirements of the total business logic, the functional components corresponding to different business logic can interoperate with each other through the data context corresponding to the total business logic, and after the functional components send out the corresponding control instruction, the functional components can also obtain the execution result of the control instruction through the data context. Meanwhile, the shared data contained in each functional component is determined by the business logic corresponding to the functional component, so that the writing authority of the shared data is controlled in the functional component, the stability of the functional components is improved, the functional components are in a high-cohesion and low-coupling state, the coding is convenient for developers, and the realization efficiency and stability of the total business logic are also improved.
In summary, the present disclosure registers a target functional component in a data context corresponding to a total service logic, where the target functional component includes a target service logic and target shared data corresponding to the target service logic, and the target service logic belongs to the total service logic. And the first functional component acquires first result data of the first control instruction executed by the target functional component by using the data context, wherein the first result data belongs to target shared data. The method and the device realize the interoperation among all the functional components in the total business logic by setting the data context of the total business logic, and can uniformly manage all the functional components, so that the structure of the total business logic is convenient to manage, and the realization efficiency and the stability of the total business logic are improved.
FIG. 2 is a flow chart illustrating another method of implementing business logic according to an exemplary embodiment, as shown in FIG. 2, step 101 includes:
in step 1011, a target placeholder is determined from among the plurality of placeholders included in the data context, and the data type of the target placeholder matches the data type of the target shared data, the data type being a static data type.
In step 1012, the target function component is registered with the target stub Fu Bangding.
For example, a data context may include a plurality of placeholders, where each placeholder corresponds to a set of data types, which may include one or more types of methods and may include one or more types of objects. For whether the data type of the placeholder is variable, the placeholder may be classified into a variable mutableDataHolder class and an invariable DataHolder class, the mutableDataHolder class corresponding to the mutableDataModel class, the DataHolder class corresponding to the DataModel class. In the data context, when registering the target functional component, the data type of the target functional component is acquired first, and then the target placeholder matched with the data type of the target functional component is searched for in a plurality of placeholders. A target placeholder matching the data type of the target functional component may be understood as having the same data type as the data type of the target functional component. The target function component is then registered with the target stub Fu Bang, thereby completing the registration of the target function component. The target placeholder is used to specify the specification of the target functional component, i.e. the target placeholder is capable of restricting external operations on the target functional component.
It should be noted that, the data types of the target placeholder and the data types of the target functional component are both static data types (which can be understood as strong types), if the types are incompatible, a compiling error is caused in the process of binding the target functional component and the target placeholder, so that the problem of incompatibility of the types can be found in the compiling stage, and the error is not reported in the process of running the application program. Thus, the type checking capability of the compiler is utilized, and safe data sharing is realized.
Accordingly, the implementation manner of step 102 may be:
and sending a first control instruction to the target functional component by using the target placeholder through the first functional component.
The implementation manner of step 103 may be:
and acquiring, by the first functional component, first result data of the target functional component executing the first control instruction by using the target placeholder.
For example, as shown in fig. 3, the architecture diagram between the first functional component, the target functional component, and the data context may refer to the target placeholder in the data context as a transmission interface or a container for communication having the same data type as the data type of the target functional component. The first functional component transmits a first control instruction to the target functional component through the target placeholder, the target placeholder acquires first result data for executing the first control instruction from the target functional component, and finally the first functional component acquires the first result data through the target placeholder.
FIG. 4 is a flow chart illustrating another method of implementing business logic, as shown in FIG. 4, according to an exemplary embodiment, the method further comprising:
step 104, determining registered functional components registered in the data context according to whether each placeholder is bound, and starting from binding of the registered functional components with the corresponding placeholders to unbinding of the registered functional components with the corresponding placeholders.
In a particular application scenario, the lifecycle of registered functional components registered in a data context may be managed according to whether each placeholder is bound. The registered functional components may be determined by observing binding or unbinding events of the functional components using an entityChanged () method in the DataHolder class (or the MutableDataHolder class). For example, the data context includes 15 placeholders, wherein 5 placeholders are bound, and then 5 functional components corresponding to the 5 placeholders are registered functional components. The lifecycle of each registered functional component begins with the registered functional component binding with the corresponding placeholder to the end of the binding of the registered functional component with the corresponding placeholder. I.e. the total service logic comprises a plurality of service logics, each service logic in the plurality of service logics corresponds to a functional component. Before a functional component is unbound to a placeholder in a data context, the functional component does not have a lifecycle until the functional component is pinned to a corresponding placeholder Fu Bang, then the lifecycle of the functional component begins. If the functional component is unbundled with the corresponding placeholder, the lifecycle of the functional component ends. Therefore, each functional component can discover and monitor the life cycle of other functional components through the data context, memory leakage is avoided, optimization measures such as delayed loading and lazy loading of the functional components are greatly facilitated, a developer does not need to additionally write complex codes for managing the life cycle, and the realization efficiency and stability of the total business logic are further improved.
FIG. 5 is a flow chart illustrating another method of implementing business logic, according to an exemplary embodiment, as shown in FIG. 5, the method further comprising:
step 105, unbinding the registered function components and the corresponding placeholders when the data context is destroyed.
Further, when the application program is closed, the total business logic is destroyed, the data context is destroyed, and when the data context is destroyed, the registered functional component and the corresponding placeholder can be unbinding first, so that the life cycle of the registered functional component is finished, the registered functional component can not be accessed any more, and the memory leakage can be further avoided.
FIG. 6 is a flow chart illustrating another method of implementing business logic, according to an exemplary embodiment, as shown in FIG. 6, the target shared data includes: a shared object, and/or a sharing method, the method further comprising:
step 106, obtaining the variable object in the case that the variable object in the shared object is changed through the data context.
Step 107, obtaining, by the first functional component, the mutable object using the data context.
For example, for a data context, a target functional component may be considered a state machine, receiving different instructions, returning corresponding result data. The target shared data may include a shared object and a sharing method. For example, the target functional component may receive the control parameter included in the first control instruction, then transmit the control parameter to the sharing method to execute the sharing method, and finally, the returned result of the sharing method is the first result data. The target function component may further receive a query condition included in the first control instruction, then search for a shared object that meets the query condition according to the query condition, and finally use a state of the shared object as the first result data.
The shared object may include a variable object and an immutable object, the state of the variable object may be changed, and the state of the immutable object may remain unchanged. A stateChanged method may be created in the data context to monitor the mutable object and return the state of the mutable object when the mutable object changes. In this way, the first functional component is able to obtain the state of the changed mutable object using the data context. Further, a method of creating a mute within the data context may be provided for receiving a set of control instructions (which may be control instructions sent by the first functional component, and/or other functional components) and then determining corresponding result data based on the set of control instructions. For example, three types of parameters S, A, R may be included in the MutableDataModel class, where S represents the state of the variable object, A represents the control instruction received (which may be the first control instruction, for example), and R represents the result data.
FIG. 7 is a flowchart illustrating another method of implementing business logic, according to an exemplary embodiment, as shown in FIG. 7, which may further include:
and step 108, taking a global object preset in the data context as an identifier of the data context.
And step 109, transmitting, by the second functional component, a second control instruction to the target functional component by using the identifier, so that the target functional component executes the second control instruction according to the target service logic.
Step 110, obtaining, by the second functional component, second result data of the target functional component executing the second control instruction by using the identifier, where the second result data belongs to the target shared data. The second functional component includes second business logic that does not belong to the total business logic.
For example, a global object may be set in the data context in advance as an identifier (i.e., key value, key) of the data context. For example, the identifier may be specified by a method of datacontext. Thus, the functional components in other application programs except the total business logic can access the data context through the identifier, thereby realizing the sharing of the target functional components. Taking a second functional component in other application programs as an example, the second functional component can find a data context through the identifier, then send a second control instruction to the target functional component through the data context, and the data context can forward the second control instruction to the target functional component, so that the target functional component can execute the second control instruction according to the target business logic. At this time, the data context may be understood as an interface where the second functional component operates the target functional component, and the second functional component may transmit the second control instruction to the target functional component through the data context only when the second control instruction meets a rule of the target functional component, that is, the target functional component is able to receive the second control instruction.
The target functional component may execute the second control instruction in accordance with the target business logic. Thereafter, the data context may obtain second result data of the target functional component executing the second control instruction, and then the second result data is obtained from the data context by the second functional component through the identifier, so that the second functional component can obtain an execution result of the second control instruction. Likewise, the second result data also belongs to the target sharing number. This enables interoperability between cross-application functional components.
Further, when the data context is destroyed, the identifier is destroyed, so that the sharing of the target functional component is automatically released, and the second functional component only can access the empty object through the identifier, thereby avoiding memory leakage.
In summary, the present disclosure registers a target functional component in a data context corresponding to a total service logic, where the target functional component includes a target service logic and target shared data corresponding to the target service logic, and the target service logic belongs to the total service logic. And the first functional component acquires first result data of the first control instruction executed by the target functional component by using the data context, wherein the first result data belongs to target shared data. The method and the device realize the interoperation among all the functional components in the total business logic by setting the data context of the total business logic, and can uniformly manage all the functional components, so that the structure of the total business logic is convenient to manage, and the realization efficiency and the stability of the total business logic are improved.
Fig. 8 is a schematic diagram of a system for implementing business logic, as shown in fig. 8, according to an exemplary embodiment, the system 200 includes: the data context 201, the target functional component 202 and the first functional component 203 corresponding to the total business logic. The target function component 202 includes target service logic and target shared data corresponding to the target service logic, the total service logic includes target service logic, the first function component 203 includes first service logic, and the first service logic is any service logic except the target service logic in the total service logic.
The data context 201 is used to register the target function component 202.
The first functional component 203 is configured to send a first control instruction to the target functional component 202 through the data context 201, so that the target functional component 202 executes the first control instruction according to the target business logic.
The first functional component 203 is configured to obtain, through the data context 201, first result data of the target functional component 202 executing the first control instruction, where the first result data belongs to the target shared data.
Optionally, the data context 201 is used to:
among the plurality of placeholders included in the data context 201, a target placeholder is determined, the data type of which matches the data type of the target shared data, the data type being a static data type. The target function component 202 is registered with the target stub Fu Bangding.
Optionally, the first functional component 203 is configured to send a first control instruction to the target functional component 202 using the target placeholder.
The first function component 203 is configured to obtain first result data of the target function component 202 executing the first control instruction using the target placeholder.
Optionally, the data context 201 is also used to:
a registered functional component registered in the data context is determined based on whether each placeholder is bound, and a lifecycle of the registered functional component is from a binding of the registered functional component with the corresponding placeholder to a unbinding of the registered functional component with the corresponding placeholder.
Optionally, the data context 201 is also used to:
when the data context 201 is destroyed, the registered functional components are unbundled from the corresponding placeholders.
Optionally, the target sharing data includes: the shared object, and/or the sharing method, the data context 201 is also used to: in the case where a variable object in the shared object changes, the variable object is acquired.
A first functional component 203 for acquiring a variable object using the data context 201.
Optionally, the system 200 further comprises: the second functional component 204, the second functional component 204 comprising second business logic, the second business logic not belonging to the total business logic.
The data context 201 is used to take a global object preset in the data context as an identifier of the data context.
The second function component 204 is configured to send a second control instruction to the target function component 202 through the identifier, so that the target function component 202 executes the second control instruction according to the target service logic.
The second function component 204 is configured to obtain, through the identifier, second result data of the target function component 202 for executing the second control instruction, where the second result data belongs to the target shared data.
The specific manner in which the data context, target functional component, and first functional component perform operations in relation to the system of the above embodiments have been described in detail in relation to embodiments of the method and will not be described in detail herein.
In summary, the present disclosure registers a target functional component in a data context corresponding to a total service logic, where the target functional component includes a target service logic and target shared data corresponding to the target service logic, and the target service logic belongs to the total service logic. And the first functional component acquires first result data of the first control instruction executed by the target functional component by using the data context, wherein the first result data belongs to target shared data. The method and the device realize the interoperation among all the functional components in the total business logic by setting the data context of the total business logic, and can uniformly manage all the functional components, so that the structure of the total business logic is convenient to manage, and the realization efficiency and the stability of the total business logic are improved.
Referring now to fig. 9, a schematic diagram of an electronic device 300 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 9 is merely an example, and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 9, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
In general, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 308 including, for example, magnetic tape, hard disk, etc.; and communication means 309. The communication means 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. While fig. 9 shows an electronic device 300 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via a communication device 309, or installed from a storage device 308, or installed from a ROM 302. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing means 301.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: registering a target functional component in a data context corresponding to a total business logic, wherein the target functional component comprises target business logic and target shared data corresponding to the target business logic, and the total business logic comprises the target business logic; transmitting a first control instruction to the target functional component by using the data context through the first functional component so that the target functional component executes the first control instruction according to the target business logic; acquiring, by the first functional component, first result data of the target functional component executing the first control instruction by using the data context, where the first result data belongs to the target shared data; the first functional component comprises first business logic, and the first business logic is any business logic except the target business logic in the total business logic.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, example 1 provides a method for implementing business logic, including: registering a target functional component in a data context corresponding to a total business logic, wherein the target functional component comprises target business logic and target shared data corresponding to the target business logic, and the total business logic comprises the target business logic; transmitting a first control instruction to the target functional component by using the data context through the first functional component so that the target functional component executes the first control instruction according to the target business logic; acquiring, by the first functional component, first result data of the target functional component executing the first control instruction by using the data context, where the first result data belongs to the target shared data; the first functional component comprises first business logic, and the first business logic is any business logic except the target business logic in the total business logic.
In accordance with one or more embodiments of the present disclosure, example 2 provides the method of example 1, the registering a target functional component in a data context corresponding to total business logic, comprising: determining a target placeholder in a plurality of placeholders included in the data context, wherein the data type of the target placeholder is matched with the data type of the target shared data, and the data type is a static data type; the target function component is registered with the target stub Fu Bangding.
According to one or more embodiments of the present disclosure, example 3 provides the method of example 2, the sending, by the first functional component, the first control instruction to the target functional component using the data context, including: transmitting, by the first functional component, the first control instruction to the target functional component using the target placeholder; the obtaining, by the first functional component, first result data of the target functional component executing the first control instruction using the data context includes: and acquiring, by the first functional component, the first result data of the target functional component for executing the first control instruction by using the target placeholder.
In accordance with one or more embodiments of the present disclosure, example 4 provides the method of example 2, the method further comprising: and determining registered functional components registered in the data context according to whether each placeholder is bound or not, wherein the life cycle of the registered functional components starts from the binding of the registered functional components and the corresponding placeholders to the unbinding of the registered functional components and the corresponding placeholders.
Example 5 provides the method of example 4, according to one or more embodiments of the present disclosure, the method further comprising: and unbinding the registered functional components and the corresponding placeholders when the data context is destroyed.
According to one or more embodiments of the present disclosure, example 6 provides the method of any one of examples 1 to 5, the target sharing data comprising: a shared object, and/or a sharing method, the method further comprising: acquiring a variable object in the shared object under the condition that the variable object changes through the data context; and acquiring the variable object by the first functional component by utilizing the data context.
According to one or more embodiments of the present disclosure, example 7 provides the method of any one of examples 1 to 5, the method further comprising: taking a global object preset in the data context as an identifier of the data context; transmitting, by the second functional component, a second control instruction to the target functional component using the identifier, so that the target functional component executes the second control instruction according to the target business logic; acquiring, by the second functional component, second result data of the target functional component executing the second control instruction by using the identifier, the second result data belonging to the target shared data; the second functional component includes second business logic that does not belong to the total business logic.
Example 8 provides a system for implementing business logic, according to one or more embodiments of the present disclosure, comprising: the data context, the target functional component and the first functional component corresponding to the total business logic; the target functional component comprises target service logic and target shared data corresponding to the target service logic, the total service logic comprises the target service logic, the first functional component comprises first service logic, and the first service logic is any service logic except the target service logic in the total service logic; the data context is used for registering the target functional component; the first functional component is used for sending a first control instruction to the target functional component through the data context so that the target functional component executes the first control instruction according to the target business logic; the first functional component is configured to obtain, through the data context, first result data of the target functional component for executing the first control instruction, where the first result data belongs to the target shared data.
According to one or more embodiments of the present disclosure, example 9 provides a computer-readable medium having stored thereon a computer program which, when executed by a processing device, implements the steps of the methods described in examples 1 to 7.
In accordance with one or more embodiments of the present disclosure, example 10 provides an electronic device, comprising: a storage device having a computer program stored thereon; processing means for executing the computer program in the storage means to realize the steps of the method described in examples 1 to 7.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims. The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.

Claims (10)

1. A method for implementing business logic, the method comprising:
registering a target functional component in a data context corresponding to a total business logic, wherein the target functional component comprises target business logic and target shared data corresponding to the target business logic, and the total business logic comprises the target business logic;
transmitting a first control instruction to the target functional component by using the data context through the first functional component so that the target functional component executes the first control instruction according to the target business logic;
acquiring, by the first functional component, first result data of the target functional component executing the first control instruction by using the data context, where the first result data belongs to the target shared data; the first functional component comprises first business logic, wherein the first business logic is any business logic except the target business logic in the total business logic;
Registering a target functional component in a data context corresponding to the total business logic, wherein the registering comprises the following steps:
determining a target placeholder among a plurality of placeholders included in the data context;
the target function component is registered with the target stub Fu Bangding.
2. The method of claim 1, wherein the data type of the target placeholder matches a data type of the target shared data, the data type being a static data type.
3. The method of claim 2, wherein the sending, by the first functional component, the first control instruction to the target functional component using the data context comprises:
transmitting, by the first functional component, the first control instruction to the target functional component using the target placeholder;
the obtaining, by the first functional component, first result data of the target functional component executing the first control instruction using the data context includes:
and acquiring, by the first functional component, the first result data of the target functional component for executing the first control instruction by using the target placeholder.
4. The method according to claim 2, wherein the method further comprises:
and determining registered functional components registered in the data context according to whether each placeholder is bound or not, wherein the life cycle of the registered functional components starts from the binding of the registered functional components and the corresponding placeholders to the unbinding of the registered functional components and the corresponding placeholders.
5. The method according to claim 4, wherein the method further comprises:
and unbinding the registered functional components and the corresponding placeholders when the data context is destroyed.
6. The method of any of claims 1-5, wherein the target shared data comprises: a shared object, and/or a sharing method, the method further comprising:
acquiring a variable object in the shared object under the condition that the variable object changes through the data context;
and acquiring the variable object by the first functional component by utilizing the data context.
7. The method according to any one of claims 1-5, further comprising:
Taking a global object preset in the data context as an identifier of the data context;
transmitting, by the second functional component, a second control instruction to the target functional component using the identifier, so that the target functional component executes the second control instruction according to the target business logic;
acquiring, by the second functional component, second result data of the target functional component executing the second control instruction by using the identifier, the second result data belonging to the target shared data; the second functional component includes second business logic that does not belong to the total business logic.
8. A system for implementing business logic, the system comprising: the data context, the target functional component and the first functional component corresponding to the total business logic; the target functional component comprises target service logic and target shared data corresponding to the target service logic, the total service logic comprises the target service logic, the first functional component comprises first service logic, and the first service logic is any service logic except the target service logic in the total service logic;
The data context is used for registering the target functional component;
the first functional component is used for sending a first control instruction to the target functional component through the data context so that the target functional component executes the first control instruction according to the target business logic;
the first functional component is configured to obtain, through the data context, first result data of the target functional component for executing the first control instruction, where the first result data belongs to the target shared data;
the registering the target function component includes:
determining a target placeholder among a plurality of placeholders included in the data context; the target function component is registered with the target stub Fu Bangding.
9. A computer readable medium on which a computer program is stored, characterized in that the program, when being executed by a processing device, carries out the steps of the method according to any one of claims 1-7.
10. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method according to any one of claims 1-7.
CN202010220411.7A 2020-03-25 2020-03-25 Method, system, readable medium and electronic device for realizing business logic Active CN111414152B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010220411.7A CN111414152B (en) 2020-03-25 2020-03-25 Method, system, readable medium and electronic device for realizing business logic

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010220411.7A CN111414152B (en) 2020-03-25 2020-03-25 Method, system, readable medium and electronic device for realizing business logic

Publications (2)

Publication Number Publication Date
CN111414152A CN111414152A (en) 2020-07-14
CN111414152B true CN111414152B (en) 2023-04-21

Family

ID=71493150

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010220411.7A Active CN111414152B (en) 2020-03-25 2020-03-25 Method, system, readable medium and electronic device for realizing business logic

Country Status (1)

Country Link
CN (1) CN111414152B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112596720A (en) * 2020-12-25 2021-04-02 第四范式(北京)技术有限公司 Service operation method and device, electronic equipment and computer storage medium
CN114764484A (en) * 2021-01-13 2022-07-19 武汉斗鱼网络科技有限公司 Lazy loading implementation method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008016694A2 (en) * 2006-08-02 2008-02-07 Vusion, Inc. Improved distribution of content on a network
CN107203419A (en) * 2016-03-17 2017-09-26 阿里巴巴集团控股有限公司 Intermodule call method, apparatus and system in application program
CN110347494A (en) * 2019-07-17 2019-10-18 深圳前海微众银行股份有限公司 Context information management method, apparatus, system and computer readable storage medium
CN110673918A (en) * 2019-09-27 2020-01-10 北京猎户星空科技有限公司 Control method and device of intelligent equipment, intelligent equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11477093B2 (en) * 2004-12-14 2022-10-18 Kyndryl, Inc. Coupling of a business component model to an information technology model
US9513979B2 (en) * 2013-01-11 2016-12-06 Sap Se Mobile communication device providing interconnectivity between apps based on storage scope
US9674819B2 (en) * 2013-03-15 2017-06-06 Qualcomm Incorporated Systems and methods for sharing context information in a neighbor aware network
US10223093B2 (en) * 2014-12-12 2019-03-05 Pcms Holdings, Inc. Method and system for context-based control over access to personal data
US20170084188A1 (en) * 2015-09-17 2017-03-23 Fujitsu Limited Providing context to a question
GB2550903B (en) * 2016-05-27 2019-06-12 Arm Ip Ltd Context data control

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008016694A2 (en) * 2006-08-02 2008-02-07 Vusion, Inc. Improved distribution of content on a network
CN107203419A (en) * 2016-03-17 2017-09-26 阿里巴巴集团控股有限公司 Intermodule call method, apparatus and system in application program
CN110347494A (en) * 2019-07-17 2019-10-18 深圳前海微众银行股份有限公司 Context information management method, apparatus, system and computer readable storage medium
CN110673918A (en) * 2019-09-27 2020-01-10 北京猎户星空科技有限公司 Control method and device of intelligent equipment, intelligent equipment and storage medium

Also Published As

Publication number Publication date
CN111414152A (en) 2020-07-14

Similar Documents

Publication Publication Date Title
CN110851139B (en) Method and device for checking codes and electronic equipment
CN112214408B (en) Dependency conflict detection method, dependency conflict detection device, electronic equipment and computer readable medium
CN111796865B (en) Byte code file modification method, device, terminal equipment and medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN113835992B (en) Memory leakage processing method and device, electronic equipment and computer storage medium
CN111414152B (en) Method, system, readable medium and electronic device for realizing business logic
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN111625232B (en) Method and device for generating application program installation package, readable medium and electronic equipment
CN113391860B (en) Service request processing method and device, electronic equipment and computer storage medium
CN112527302B (en) Error detection method and device, terminal and storage medium
CN110888773B (en) Method, device, medium and electronic equipment for acquiring thread identification
CN111625326B (en) Task pipeline execution method and device and electronic equipment
CN111399902B (en) Client source file processing method and device, readable medium and electronic equipment
CN116263824A (en) Resource access method and device, storage medium and electronic equipment
CN111324336B (en) Method, device, terminal and storage medium for implementing dependency injection
CN113448550B (en) Method and device for realizing collection management of classes, electronic equipment and computer medium
CN114706645B (en) Interface information transmission method, device, medium and electronic equipment
CN112711400B (en) View processing method, device and storage medium
CN114116517B (en) Front-end item analysis method and device, medium and electronic equipment
CN109933334B (en) Program execution method, device, equipment and medium
CN112486494A (en) File generation method and device, electronic equipment and computer readable storage medium
CN116594630A (en) File generation method, device, medium and electronic equipment
CN117472425A (en) Resource processing method and device, readable medium and electronic equipment
CN116737254A (en) Class loading method, device, equipment and medium
CN117311838A (en) File processing method, device, equipment and storage medium based on dynamic plug-in

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant