Data-driven method, apparatus, device, computer-readable medium, and program product

By intercepting operation requests through data-driven objects and generating and notifying operation parameter objects, the inefficiency caused by the complexity of writing code and the large size of the framework in existing technologies is solved, thus achieving simplified writing and efficient responsive development.

CN116185521BActive Publication Date: 2026-03-17BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211584665.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-09
Publication Date
2026-03-17
Estimated Expiration
2042-12-09

AI Technical Summary

Technical Problem

Existing technologies for implementing data-driven processes are complex to write using the methods provided by the languages ​​themselves, and lightweight development frameworks have limited functionality, resulting in low efficiency of responsive development. Furthermore, large frameworks are too bulky, which affects the efficiency of data-driven processes.

Method used

By intercepting operation requests through data-driven objects, determining operation parameter information, generating operation parameter objects, automatically calling callback methods, and notifying consumer objects of data changes, complex class definitions and third-party frameworks are avoided, enabling fully functional responsive development.

Benefits of technology

It simplifies the coding process, adds responsive features, reduces application size, and improves data-driven efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116185521B_ABST
    Figure CN116185521B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose a data driving method, device, equipment, computer readable medium and program product. A specific implementation of the method comprises: in response to determining that a data driving object intercepts an operation method called in response to an operation request, determining operation parameter information of the corresponding operation method; generating operation parameter object information according to the data driving object identifier, operation method parameter information and operation selector of the operation method; determining each operation listener object identifier of the data driving object corresponding to the data driving object identifier according to the data driving object identifier; inputting the operation parameter object information as input parameters into the callback method corresponding to each operation listener object identifier determined, so as to notify the operation object information returned by the callback method to the consumer object corresponding to the operation listener object identifier. The implementation is related to data driving, and improves the efficiency of implementing data driving of an application program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of this disclosure relate to the field of computer technology, and more particularly to data-driven methods, apparatus, devices, computer-readable media, and program products. Background Technology

[0002] In any client-side programming language, the data-driven flow of a system—including pages, components, functions, data, and calls between functions—needs proper encapsulation, organization, and design. Currently, implementing data-driven flows typically relies on methods provided by the language itself or third-party frameworks.

[0003] However, the inventors discovered that when implementing data-driven processes in the above manner, the following technical problems often arise: the programming methods provided by the language itself are relatively complex; when implementing responsive development, a lightweight development framework can only implement a relatively simple responsive solution with fewer functions, while a development framework with more functions is larger in size, resulting in low efficiency in implementing data-driven processes.

[0004] The information disclosed in this background section is only intended to enhance the understanding of the background of the inventive concept, and therefore may contain information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The summary portion of this disclosure is intended to provide a brief overview of the concepts, which will be described in detail in the detailed description portion. This summary portion is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.

[0006] Some embodiments of this disclosure provide data-driven methods, apparatuses, electronic devices, computer-readable media, and computer program products to address one or more of the technical problems mentioned in the background section above.

[0007] In a first aspect, some embodiments of this disclosure provide a data-driven method, the method comprising: in response to determining that a data-driven object intercepts an operation method invoked in response to an operation request, determining operation parameter information corresponding to the operation method, wherein the operation parameter information includes operation method input parameter information and a data-driven object identifier of the data-driven object; generating operation parameter object information based on the data-driven object identifier, the operation method input parameter information, and the operation selector of the operation method; determining, based on the data-driven object identifier, each operation listening object identifier corresponding to the data-driven object has a corresponding callback method, wherein the return result of the callback method includes operation object information; and inputting the operation parameter object information as input parameters to the callback method corresponding to each determined operation listening object identifier, so as to notify the consumer object corresponding to the operation listening object identifier of the operation object returned by the callback method.

[0008] Optionally, before determining the operation parameter information corresponding to the operation method in response to the determination that the data-driven object has intercepted the operation method called in response to the operation request, the method further includes: in response to receiving the operation request sent by the terminal device, calling the operation method corresponding to the operation request to obtain the operation request result; and sending the operation request result to the terminal device.

[0009] Optionally, determining the operation listener object identifiers of the data-driven object corresponding to the data-driven object identifier based on the data-driven object identifier includes: obtaining the listener association object corresponding to the data-driven object identifier, wherein the listener association object corresponding to the data-driven object identifier is an array object, and the array object stores at least one operation listener object identifier; and determining the operation listener object identifiers stored in the listener association object as the operation listener object identifiers corresponding to the data-driven object.

[0010] Optionally, the method further includes: in response to detecting operation listener object addition information corresponding to the data-driven object, adding the operation listener object identifier included in the operation listener object addition information to the array object to update the array object.

[0011] Optionally, before determining the operation parameter information corresponding to the operation method in response to determining that the data-driven object has intercepted the operation method called in response to the operation request, the method further includes: obtaining the data-driven class information of the data-driven object; obtaining the listener identifier of the data-driven class of the data-driven object based on the data-driven class information; obtaining the method identifier set of the data-driven class in response to determining that the listener identifier indicates that it has not been listened to; for each method identifier in the method identifier set, performing the following steps: obtaining the operation selector corresponding to the method identifier; determining whether the method identifier meets the preset operation method conditions based on the operation selector; and intercepting the method corresponding to the method identifier in response to determining that the method identifier meets the preset operation method conditions.

[0012] Optionally, the method further includes: determining a context object corresponding to the data-driven object, wherein the context object corresponds to a set of data-driven object identifiers containing data-driven object identifiers of the data-driven object; in response to detecting consumer registration information corresponding to the context object, creating a consumer object based on the consumer registration information, wherein the consumer object can access the data-driven objects corresponding to each data-driven object identifier in the set of data-driven object identifiers.

[0013] Optionally, the method further includes: associating the aforementioned context object and the aforementioned consumer object, such that the aforementioned context object serves as the context associated object of the aforementioned consumer object.

[0014] Optionally, the method further includes: in response to detecting the sub-object registration information corresponding to the aforementioned consumer object, creating a consumer sub-object based on the sub-object registration information, wherein the aforementioned consumer sub-object can access the data-driven objects corresponding to each data-driven object identifier in the aforementioned data-driven object identifier set.

[0015] Optionally, the method further includes: in response to detecting modification information of the context object by the consumer object or the consumer sub-object, modifying the context object according to the modification information to update the context object.

[0016] Secondly, some embodiments of this disclosure provide a data-driven apparatus, comprising: a first determining unit configured to, in response to a determined data-driven object intercepting an operation method invoked in response to an operation request, determine operation parameter information corresponding to the operation method, wherein the operation parameter information includes operation method input parameter information and a data-driven object identifier of the data-driven object; a generating unit configured to generate operation parameter object information based on the data-driven object identifier, the operation method input parameter information, and an operation selector of the operation method; a second determining unit configured to, based on the data-driven object identifier, determine each operation listening object identifier corresponding to the data-driven object, wherein each determined operation listening object identifier corresponds to an operation listening object with a callback method, and the return result of the callback method includes operation object information; and an input unit configured to input the operation parameter object information as input parameters to the callback method corresponding to each determined operation listening object identifier, so as to notify the consumer object corresponding to the operation listening object identifier of the operation object information returned by the callback method.

[0017] Optionally, prior to the first determining unit, the data driving device further includes a calling unit and a sending unit. The calling unit is configured to, in response to receiving an operation request sent by the terminal device, call the operation method corresponding to the operation request to obtain the operation request result. The sending unit is configured to send the operation request result to the terminal device.

[0018] Optionally, the second determining unit is further configured to: obtain the listening associated object corresponding to the data-driven object identifier, wherein the listening associated object corresponding to the data-driven object identifier is an array object, and the array object stores at least one operation listening object identifier; and determine each operation listening object identifier stored in the listening associated object as the corresponding operation listening object identifier of the data-driven object.

[0019] Optionally, the data-driven device further includes an adding unit configured to add an operation listening object identifier included in the operation listening object addition information to the array object in response to detecting operation listening object addition information corresponding to the data-driven object, so as to update the array object.

[0020] Optionally, prior to the first determining unit, the data-driven device further includes: a first acquiring unit, a second acquiring unit, a third acquiring unit, and an execution unit. The first acquiring unit is configured to acquire data-driven class information of the data-driven object. The second acquiring unit is configured to acquire a listener identifier of the data-driven class of the data-driven object based on the data-driven class information. The third acquiring unit is configured to acquire a set of method identifiers of the data-driven class in response to determining that the listener identifier indicates that no listener has been detected. The execution unit is configured to perform the following steps for each method identifier in the set of method identifiers: acquire an operation selector corresponding to the method identifier; determine whether the method identifier satisfies a preset operation method condition based on the operation selector; and intercept the method corresponding to the method identifier in response to determining that the method identifier satisfies the preset operation method condition.

[0021] Optionally, the data-driven device further includes a context object determination unit and a consumer object creation unit. The context object determination unit is configured to determine a context object corresponding to the data-driven object, wherein the context object corresponds to a set of data-driven object identifiers containing identifiers of the data-driven object. The consumer object creation unit is configured to, in response to detecting consumer registration information corresponding to the context object, create a consumer object based on the consumer registration information, wherein the consumer object can access the data-driven objects corresponding to each data-driven object identifier in the set of data-driven object identifiers.

[0022] Optionally, the data-driven device further includes: an association processing unit configured to perform association processing on the context object and the consumer object, such that the context object serves as the context association object of the consumer object.

[0023] Optionally, the data-driven device further includes a consumer sub-object creation unit, configured to create a consumer sub-object based on the sub-object registration information in response to detecting sub-object registration information corresponding to the aforementioned consumer object, wherein the consumer sub-object can access the data-driven object corresponding to each data-driven object identifier in the aforementioned data-driven object identifier set.

[0024] Optionally, the data-driven device further includes: a modification unit configured to, in response to detecting modification information of the context object by the consumer object or the consumer sub-object, modify the context object according to the modification information to update the context object.

[0025] Thirdly, some embodiments of this disclosure provide an electronic device, including: one or more processors; and a storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation of the first aspect above.

[0026] Fourthly, some embodiments of this disclosure provide a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the implementations of the first aspect above.

[0027] Fifthly, some embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any of the implementations of the first aspect above.

[0028] The above embodiments of this disclosure have the following beneficial effects: the data-driven methods of some embodiments of this disclosure simplify the writing process, increase responsive functionality, reduce application size, and thus improve the efficiency of implementing data-driven applications. Specifically, the reason for the low efficiency of implementing data-driven applications is that the writing methods provided by the language itself are relatively complex. When implementing responsive development, a lightweight development framework can only implement a relatively simple responsive solution with fewer functions, while a development framework with more functions has a larger size, resulting in low efficiency of implementing data-driven applications. Based on this, the data-driven method of some embodiments of this disclosure first determines the operation parameter information corresponding to the operation method in response to the determination that the data-driven object intercepts the operation method called in response to the operation request. The operation parameter information includes the operation method input parameter information and the data-driven object identifier of the data-driven object. Thus, after receiving an operation request, the data-driven object can intercept the called operation method at any time during the response to the operation request, thereby determining the operation parameter information when the operation method is called. Then, operation parameter object information is generated according to the data-driven object identifier, the operation method input parameter information, and the operation selector of the operation method. Therefore, the operation parameter object information can be used as input parameters for the callback methods of the data-driven object for data transmission. Then, based on the aforementioned data-driven object identifier, the corresponding operation listener object identifiers for each data-driven object are determined. Each identified operation listener object identifier corresponds to a callback method, and the return result of the callback method includes the operation object information. Thus, the operation listener objects that need to be monitored for the operation methods of the data-driven object can be identified. Finally, the aforementioned operation parameter object information is used as input parameters and input to the callback method corresponding to each identified operation listener object identifier to notify the consumer object corresponding to the operation listener object identifier of the operation object information returned by the callback method. Therefore, when an operation method call is intercepted through the data-driven object, the operation object information (i.e., data changes) returned by each callback method can be automatically notified to each consumer object. Because the data-driven object intercepts operation methods and automatically calls callback functions to notify consumer objects of data changes, complex class definitions are avoided for implementing reactive development, simplifying the coding process. Furthermore, comprehensive reactive development can be achieved without using a third-party framework, increasing reactive functionality and reducing application size. This improves the efficiency of implementing data-driven applications. Attached Figure Description

[0029] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale.

[0030] Figure 1 This is an architecture diagram of an exemplary system to which some embodiments of this disclosure can be applied;

[0031] Figure 2 These are flowcharts of some embodiments of the data-driven method according to this disclosure;

[0032] Figure 3 This is a schematic diagram of the class definition structure of a data-driven process according to some embodiments of the data-driven method of this disclosure;

[0033] Figure 4 These are flowcharts of other embodiments of the data-driven method according to this disclosure;

[0034] Figure 5 These are schematic diagrams illustrating the structure of some embodiments of the data-driven apparatus according to this disclosure;

[0035] Figure 6 This is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. Detailed Implementation

[0036] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0037] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.

[0038] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0039] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0040] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0041] The collection, storage, and use of user personal information (such as operation requests) involved in this disclosure shall be carried out in accordance with relevant laws and regulations, provided that the relevant organizations or individuals have fulfilled their obligations, including conducting personal information security impact assessments, informing personal information subjects, obtaining prior authorization and consent from personal information subjects, and other obligations before performing the corresponding operations.

[0042] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.

[0043] Figure 1 An exemplary system architecture 100 is shown that can be applied to some embodiments of the present disclosure, including a data-driven method or data-driven apparatus.

[0044] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0045] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, item information display applications, search applications, instant messaging tools, email clients, social media platform software, etc.

[0046] Terminal devices 101, 102, and 103 can be either hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with displays that support information display, including but not limited to smartphones, tablets, e-book readers, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices. They can be implemented as, for example, multiple software programs or software modules used to provide distributed services, or as a single software program or software module. No specific limitations are imposed here.

[0047] Server 105 can be a server that provides various services, such as a backend server that supports the information displayed on terminal devices 101, 102, and 103. The backend server can analyze and process received operation requests and other data, and then feed the processing results back to the terminal devices.

[0048] It should be noted that the data-driven method provided in the embodiments of this disclosure can be executed by the server 105. Accordingly, the data-driven device can be disposed in the server 105.

[0049] It should be noted that a server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules used to provide distributed services, or as a single software program or software module. No specific limitations are made here.

[0050] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0051] Continue to refer to Figure 2 The diagram illustrates a flow 200 of some embodiments of a data-driven method according to the present disclosure. This data-driven method includes the following steps:

[0052] Step 201: In response to the determination that the data-driven object intercepts the operation method called by the response operation request, determine the operation parameter information of the corresponding operation method.

[0053] In some embodiments, the execution subject of the data-driven method (e.g. Figure 1 The server shown can, in response to the interception of an operation request by a data-driven object, determine the operation parameter information corresponding to that operation method. The data-driven object can be an object instantiated from a data-driven class. The data-driven class can be a predefined data-driven base class. The data-driven class can provide operation methods to update data trigger listeners, assemble and return operation objects, and create return listener objects. The operation request can be an operation-related request sent by the client. For example, an operation request can be a request triggered by a user's action on a page. The operation method can be a method called in response to the operation request. The operation method can be a method provided by the data-driven object. Each operation method corresponds to an operation object.

[0054] The operation object described above can be an object instantiated from an operation class. The operation class described above can be a predefined class. The operation class described above can correspond to data-driven object variables, operation selector variables, and parameter variables. Parameter variables can be array-type variables. The operation object can be instantiated with data-driven object variables, operation selector variables, and parameter variables as input parameters. Here, the data-driven object corresponding to the operation object described above can be the aforementioned data-driven object. The operation selector corresponding to the operation object described above can be a selector of type SEL.

[0055] The aforementioned listener object can be an object instantiated from a listener class. The aforementioned listener class can be a predefined class. The aforementioned listener class can correspond to a data-driven object variable and a callback method. The parameter of the callback method is an operation object of an operation class, which can be used to pass operation-related information. Therefore, the class definition upon which the data-driven process depends can be as follows: Figure 3 As shown, the class definitions that implement the data-driven process can include operation class definitions, listener class definitions, and data-driven class definitions.

[0056] In practice, the aforementioned executing entity can determine the parameter variables corresponding to the aforementioned operation object and the data-driven object identifier of the aforementioned data-driven object as operation parameter information. This operation parameter information can include operation method input parameter information and the data-driven object identifier of the aforementioned data-driven object. The operation method input parameter information is the aforementioned parameter variable. The data-driven object identifier can be the name of the aforementioned data-driven object.

[0057] Optionally, before step 201, the aforementioned execution entity may, in response to receiving an operation request sent by the terminal device, call the operation method corresponding to the operation request to obtain the operation request result. Then, the operation request result can be sent to the terminal device. Thus, the listening logic of the operation method can be executed after the operation method is called.

[0058] Optionally, before step 201, the execution entity can first obtain the data-driven class information of the data-driven object. This data-driven class information can be related to the class definition of the data-driven object. For example, the data-driven class information may include the name of the data-driven class. In practice, the execution entity can obtain the data-driven class information of the data-driven object through a method that retrieves the class definition. For example, the method for retrieving the class definition can be the runtime's `object_getClass` method.

[0059] Then, based on the aforementioned data-driven class information, the listener identifier of the data-driven class of the aforementioned data-driven object can be obtained. In practice, the aforementioned execution entity can obtain the listener identifier of the data-driven class of the aforementioned data-driven object through a method for obtaining associated objects. For example, the method for obtaining associated objects can be the `getAssociatedObject` method.

[0060] Subsequently, in response to determining that the aforementioned listening identifier representation is not being listened to, the method identifier set of the aforementioned data-driven class can be obtained. In practice, the aforementioned execution entity can obtain the method identifier set of the aforementioned data-driven class through a method for obtaining a list of class method identifiers. For example, the method for obtaining a list of class method identifiers can be the class_copyMethodList API method in the runtime.

[0061] Finally, for each method identifier in the above set of method identifiers, perform the following steps:

[0062] The first step is to obtain the operation selector corresponding to the method identifier mentioned above. In practice, the execution entity can obtain the operation selector corresponding to the method identifier by obtaining the method name. For example, the method to obtain the method name can be the `method_getName` method.

[0063] The second step is to determine whether the method identifier meets the preset operation method conditions based on the operation selector. In practice, firstly, the executing entity can serialize the operation selector into a string of a preset type. Specifically, the executing entity can serialize the operation selector into an NSString string by calling NSStringFromSelector. Then, it can be determined whether the string meets the preset operation method conditions. The preset operation method conditions can be whether the string begins with a preset operation string. The preset operation string can be a string representing an operation method. For example, the preset operation string could be "operate". Here, no specific limitations are imposed on the preset operation method conditions.

[0064] The third step involves intercepting the method corresponding to the method identifier in response to the determination that the method identifier meets the preset operation method conditions. In practice, the execution entity can intercept the method corresponding to the method identifier using an interception method. For example, it can call the hookSelector of the aspect for interception. The interception method can be aspectpositionafter, meaning the interception is triggered after the method is called. Alternatively, the interception can be triggered before or during method execution.

[0065] Therefore, it is possible to automatically intercept the operation methods of a data-driven object when it is not being monitored.

[0066] Step 202: Generate operation parameter object information based on the data-driven object identifier, operation method input parameter information, and operation method operation selector.

[0067] In some embodiments, the execution entity can generate operation parameter object information based on the data-driven object identifier, the operation method input parameter information, and the operation selector of the operation method. Here, the operation selector can be represented as a serialized string of the operation selector. In practice, the execution entity can use the data-driven object identifier, the operation method input parameter information, and the operation method operation selector as input parameters to create an operation parameter object as the operation parameter object information.

[0068] Step 203: Based on the data-driven object identifier, determine the identifiers of each operation listener object of the corresponding data-driven object.

[0069] In some embodiments, the execution entity can determine the operation listener object identifiers of each data-driven object corresponding to the data-driven object identifier based on the data-driven object identifier. The operation listener object identifier can be the name of the listener object used to listen to operation methods. Each determined operation listener object identifier corresponds to an operation listener object with a callback method. The return result of the callback method can include operation object information, which can be the name of the operation object. In practice, the execution entity can determine the operation listener object identifiers of each operation listener object corresponding to the data-driven object identifier as the operation listener object identifiers of each data-driven object corresponding to the data-driven object identifier.

[0070] In some optional implementations of certain embodiments, the execution entity first obtains the listening associated object corresponding to the data-driven object identifier. The listening associated object can be an associated object used for listening, linked to the data-driven object corresponding to the data-driven object identifier. The listening associated object corresponding to the data-driven object identifier can be an array object. The array object can store at least one operation listening object identifier. The array object can be an array object initialized using a weak reference. In practice, the execution entity can obtain the listening associated object corresponding to the data-driven object identifier using a method that obtains the associated object. For example, the method for obtaining the associated object can be the `getAssociatedObject` method. Then, the operation listening object identifiers stored in the listening associated object can be determined as the corresponding operation listening object identifiers of the data-driven object. Therefore, the operation listening objects of the data-driven object can be directly determined by obtaining the associated object, simplifying the coding process.

[0071] Step 204: Input the operation parameter object information as an input parameter to the callback method corresponding to each determined operation listener object identifier, so as to notify the consumer object corresponding to the operation listener object identifier of the operation object information returned by the callback method.

[0072] In some embodiments, the execution entity may use the operation parameter object information as input parameters and input it into the callback method corresponding to each determined operation listener object identifier, so as to notify the consumer object corresponding to the operation listener object identifier of the operation object information returned by the callback method. The consumer object can be an object that obtains changed data (i.e., operation object information) through the operation listener object. For example, the consumer object can be a component.

[0073] Optionally, the execution entity can also, in response to detecting the addition of operation listener object information corresponding to the data-driven object, add the operation listener object identifier included in the operation listener object addition information to the array object to update the array object. The operation listener object addition information can be information indicating the addition of a new operation listener object. The operation listener object identifier can be the name of the newly created operation listener object. The operation listener object addition information can include the data-driven object identifier, the operation listener object identifier, and the code block of the callback method. In practice, the execution entity can add the operation listener object identifier included in the operation listener object addition information to the end of the array object. It should be noted that the execution entity can also create a new operation listener object based on the data-driven object identifier and the code block of the callback method included in the operation listener object addition information. Therefore, when a new operation listener object is created, the identifier of the newly created operation object can be automatically added to the array object of the corresponding data-driven object.

[0074] The above embodiments of this disclosure have the following beneficial effects: the data-driven methods of some embodiments of this disclosure simplify the writing process, increase responsive functionality, reduce application size, and thus improve the efficiency of implementing data-driven applications. Specifically, the reason for the low efficiency of implementing data-driven applications is that the writing methods provided by the language itself are relatively complex. When implementing responsive development, a lightweight development framework can only implement a relatively simple responsive solution with fewer functions, while a development framework with more functions has a larger size, resulting in low efficiency of implementing data-driven applications. Based on this, the data-driven method of some embodiments of this disclosure first determines the operation parameter information corresponding to the operation method in response to the determination that the data-driven object intercepts the operation method called in response to the operation request. The operation parameter information includes the operation method input parameter information and the data-driven object identifier of the data-driven object. Thus, after receiving an operation request, the data-driven object can intercept the called operation method at any time during the response to the operation request, thereby determining the operation parameter information when the operation method is called. Then, operation parameter object information is generated according to the data-driven object identifier, the operation method input parameter information, and the operation selector of the operation method. Therefore, the operation parameter object information can be used as input parameters for the callback methods of the data-driven object for data transmission. Then, based on the aforementioned data-driven object identifier, the corresponding operation listener object identifiers for each data-driven object are determined. Each identified operation listener object identifier corresponds to a callback method, and the return result of the callback method includes the operation object information. Thus, the operation listener objects that need to be monitored for the operation methods of the data-driven object can be identified. Finally, the aforementioned operation parameter object information is used as input parameters and input to the callback method corresponding to each identified operation listener object identifier to notify the consumer object corresponding to the operation listener object identifier of the operation object information returned by the callback method. Therefore, when an operation method call is intercepted through the data-driven object, the operation object information (i.e., data changes) returned by each callback method can be automatically notified to each consumer object. Because the data-driven object intercepts operation methods and automatically calls callback functions to notify consumer objects of data changes, complex class definitions are avoided for implementing reactive development, simplifying the coding process. Furthermore, comprehensive reactive development can be achieved without using a third-party framework, increasing reactive functionality and reducing application size. This improves the efficiency of implementing data-driven applications.

[0075] Further reference Figure 4 This illustrates a flow 400 of another embodiment of the data-driven method. Flow 400 of the data-driven method includes the following steps:

[0076] Step 401: In response to the determination that the data-driven object intercepts the operation method called by the response operation request, determine the operation parameter information of the corresponding operation method.

[0077] Step 402: Generate operation parameter object information based on the data-driven object identifier, operation method input parameter information, and operation method operation selector.

[0078] Step 403: Based on the data-driven object identifier, determine the identifiers of each operation listener object of the corresponding data-driven object.

[0079] Step 404: Input the operation parameter object information as an input parameter to the callback method corresponding to each determined operation listener object identifier, so as to notify the consumer object corresponding to the operation listener object identifier of the operation object information returned by the callback method.

[0080] In some embodiments, the specific implementation of steps 401-404 and the resulting technical effects can be found in [reference needed]. Figure 2 Steps 201-204 in the corresponding embodiments will not be repeated here.

[0081] Step 405: Determine the context object of the corresponding data-driven object.

[0082] In some embodiments, the execution subject of the data-driven method (e.g. Figure 1 The server shown can determine the context object corresponding to the aforementioned data-driven object. This context object can be an object used to limit the access domain of an object to objects of the data-driven class. The context object can correspond to a set of data-driven object identifiers containing the data-driven object identifiers of the aforementioned data-driven object. The set of data-driven object identifiers can be represented as a data-driven object pool dictionary variable. The data-driven object pool dictionary variable can be an array variable. The context object can also correspond to methods for adding data-driven objects, obtaining the corresponding data-driven objects, registering consumer objects, and obtaining the context object of the consumer objects. In practice, the executing entity can determine the context object corresponding to the aforementioned data-driven object by including the context object of the aforementioned data-driven object in the corresponding data-driven object pool dictionary variable.

[0083] Step 406: In response to detecting the consumer registration information of the corresponding context object, create a consumer object based on the consumer registration information.

[0084] In some embodiments, the execution entity may, in response to detecting consumer registration information corresponding to the context object, create a consumer object based on the consumer registration information. The consumer object can access the data-driven objects corresponding to each data-driven object identifier in the data-driven object identifier set. The consumer registration information may represent information indicating the registration of a new consumer object. The consumer registration information may include the context object identifier and the consumer object identifier of the context object. The context object identifier may be the name of the context object. The consumer object identifier may be the name of the consumer object. In practice, the execution entity may create a consumer object named after the consumer object identifier. In practice, the consumer object can be registered during the object memory allocation stage. Thus, the registration of consumer objects can be achieved, and the registered consumer object can access any data-driven object defined by the context object.

[0085] Step 407: Perform association processing on the context object and the consumer object, so that the context object becomes the context associated object of the consumer object.

[0086] In some embodiments, the execution entity can associate the context object and the consumer object, making the context object a context associated object of the consumer object. In practice, the execution entity can set the context object as an associated object (i.e., an associated attribute) of the consumer object using a method that sets the associated object. For example, the method for setting the associated object can be the runtime-associated `objc_setAssociatedObject` method.

[0087] Optionally, the executing entity may also, in response to detecting the sub-object registration information corresponding to the consumer object, create a consumer sub-object based on the sub-object registration information. The consumer sub-object can access the data-driven objects corresponding to each data-driven object identifier in the data-driven object identifier set. The sub-object registration information can be information representing the registration of the sub-object of the consumer object. The sub-object registration information may include the sub-object identifier of the sub-object and the consumer object identifier. Therefore, the sub-objects of the consumer object can also access the data-driven objects accessible by the parent object.

[0088] Optionally, the execution entity may, in response to detecting modifications made to the context object by the consumer object or its sub-objects, modify the context object accordingly to update it. The modification information may be information about modifying the data-driven object pool dictionary variables of the context object. For example, the modification information may be information about deleting a data-driven object identifier from the data-driven object pool dictionary variables. This allows both the consumer object and its sub-objects to modify the scope of data-driven objects defined by the context object.

[0089] It should be noted that because both the consumer object and its child objects can access and modify the corresponding context object, a scope-based bidirectional data flow architecture is implemented.

[0090] from Figure 4 It can be seen from this that, with Figure 2 Compared to the description of some corresponding embodiments, Figure 4 In some corresponding embodiments, the flow 400 of the data-driven method embodies the step of extending the context object. Therefore, the schemes described in these embodiments can limit the scope of data-driven objects accessible to the associated consumer objects through the context object, eliminating the need for the consumer object to directly hold the data-driven object to determine the accessible data-driven objects. This simplifies the coding process.

[0091] Further reference Figure 5 As an implementation of the methods shown in the above figures, this disclosure provides some embodiments of a data-driven device, which are similar to... Figure 2 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.

[0092] like Figure 5As shown, a data-driven device 500 in some embodiments includes: a first determining unit 501, a generating unit 502, a second determining unit 503, and an input unit 504. The first determining unit 501 is configured to, in response to a data-driven object intercepting an operation method invoked in response to an operation request, determine operation parameter information corresponding to the operation method, wherein the operation parameter information includes operation method input parameter information and a data-driven object identifier of the data-driven object. The generating unit 502 is configured to generate operation parameter object information based on the data-driven object identifier, the operation method input parameter information, and the operation selector of the operation method. The second determining unit 503 is configured to, based on the data-driven object identifier, determine each operation listening object identifier corresponding to the data-driven object identifier, wherein each determined operation listening object identifier corresponds to an operation listening object with a callback method, and the return result of the callback method includes operation object information. The input unit 504 is configured to take the above-mentioned operation parameter object information as input parameters and input it to the callback method corresponding to each determined operation listening object identifier, so as to notify the consumer object corresponding to the above-mentioned operation listening object identifier of the operation object information returned by the callback method.

[0093] Optionally, prior to the first determining unit 501, the data driving device 500 may further include a calling unit and a sending unit (not shown in the figure). The calling unit is configured to, in response to receiving an operation request sent by the terminal device, call the operation method corresponding to the operation request to obtain the operation request result. The sending unit is configured to send the operation request result to the terminal device.

[0094] Optionally, the second determining unit 503 may be further configured to: obtain the listening associated object corresponding to the above-mentioned data-driven object identifier, wherein the listening associated object corresponding to the above-mentioned data-driven object identifier is an array object, and the array object stores at least one operation listening object identifier; and determine each operation listening object identifier stored in the above-mentioned listening associated object as the corresponding operation listening object identifier of the above-mentioned data-driven object.

[0095] Optionally, the data driving device 500 may further include an adding unit (not shown in the figure), configured to add the operation listening object identifier included in the operation listening object adding information to the array object in response to detecting operation listening object adding information corresponding to the data driving object, so as to update the array object.

[0096] Optionally, before the first determining unit 501, the data driving device 500 may further include: a first acquiring unit, a second acquiring unit, a third acquiring unit, and an execution unit (not shown in the figure). The first acquiring unit is configured to acquire data driving class information of the data driving object. The second acquiring unit is configured to acquire a listening identifier of the data driving class of the data driving object based on the data driving class information. The third acquiring unit is configured to acquire a set of method identifiers of the data driving class in response to determining that the listening identifier indicates no listening. The execution unit is configured to perform the following steps for each method identifier in the set of method identifiers: acquire an operation selector corresponding to the method identifier; determine whether the method identifier meets a preset operation method condition based on the operation selector; and intercept the method corresponding to the method identifier in response to determining that the method identifier meets the preset operation method condition.

[0097] Optionally, the data-driven device 500 may further include a context object determination unit and a consumer object creation unit (not shown in the figure). The context object determination unit is configured to determine a context object corresponding to the data-driven object, wherein the context object corresponds to a set of data-driven object identifiers containing identifiers of the data-driven object. The consumer object creation unit is configured to create a consumer object based on the consumer registration information detected corresponding to the context object, wherein the consumer object can access the data-driven objects corresponding to each data-driven object identifier in the set of data-driven object identifiers.

[0098] Optionally, the data-driven device 500 may further include an association processing unit (not shown in the figure), configured to perform association processing on the context object and the consumer object, such that the context object serves as the context association object of the consumer object.

[0099] Optionally, the data-driven device 500 may further include: a consumer sub-object creation unit (not shown in the figure), configured to create a consumer sub-object based on the sub-object registration information in response to detecting the sub-object registration information corresponding to the aforementioned consumer object, wherein the aforementioned consumer sub-object can access the data-driven object corresponding to each data-driven object identifier in the aforementioned data-driven object identifier set.

[0100] Optionally, the data driving device 500 may further include: a modification unit (not shown in the figure), configured to modify the context object according to the modification information detected by the consumer object or the consumer sub-object to update the context object.

[0101] It is understandable that the units described in the data drive device 500 and the reference Figure 2 The steps in the described method correspond accordingly. Therefore, the operations, features, and beneficial effects described above for the method also apply to the device 500 and the units contained therein, and will not be repeated here.

[0102] The following is for reference. Figure 6 It illustrates electronic devices suitable for implementing some embodiments of this disclosure (e.g., Figure 1 The structural diagram of the server (600) in the middle. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this disclosure.

[0103] like Figure 6 As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0104] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 6 Each box shown can represent a device or multiple devices as needed.

[0105] In particular, according to some embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined above in the methods of some embodiments of this disclosure.

[0106] It should be noted that, in some embodiments of this disclosure, the computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In some embodiments of this disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0107] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0108] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: in response to determining that a data-driven object intercepts an operation method invoked in response to an operation request, determine operation parameter information corresponding to the operation method, wherein the operation parameter information includes operation method input parameter information and a data-driven object identifier of the data-driven object; generate operation parameter object information based on the data-driven object identifier, the operation method input parameter information, and the operation selector of the operation method; determine, based on the data-driven object identifier, each operation listener object identifier corresponding to the data-driven object identifier, wherein each determined operation listener object identifier corresponds to an operation listener object with a callback method, the return result of the callback method including operation object information; and input the operation parameter object information as input parameters to the callback method corresponding to each determined operation listener object identifier, so as to notify the consumer object corresponding to the operation listener object identifier of the operation object information returned by the callback method.

[0109] Computer program code for performing operations of some embodiments of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0110] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0111] The units described in some embodiments of this disclosure can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor may be described as including a first determining unit, a generating unit, a second determining unit, and an input unit. The names of these units do not necessarily limit the specific unit itself; for example, the first determining unit may also be described as "a unit that determines operation parameter information corresponding to the operation method in response to a determined data-driven object intercepting an operation method invoked in response to an operation request."

[0112] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0113] Some embodiments of this disclosure also provide a computer program product, including a computer program that, when executed by a processor, implements any of the data-driven methods described above.

[0114] The above description is merely a selection of preferred embodiments of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.

Claims

1. A data driving method, comprising: in response to determining that a data driving object intercepts an operation method called in response to an operation request, determining operation parameter information corresponding to the operation method, wherein the operation parameter information comprises operation method parameter information and a data driving object identifier of the data driving object; generating operation parameter object information according to the data driving object identifier, the operation method parameter information, and an operation selector of the operation method; determining, according to the data driving object identifier, each operation listener object identifier of a data driving object corresponding to the data driving object identifier, wherein each operation listener object corresponding to each operation listener object identifier determined is provided with a callback method, and a return result of the callback method comprises operation object information; inputting the operation parameter object information as an input parameter to the callback method corresponding to each operation listener object identifier determined, so as to notify a consumer object corresponding to the operation listener object identifier of operation object information returned by the callback method.

2. The method of claim 1, wherein, Before the step of determining, in response to determining that a data driving object intercepts an operation method called in response to an operation request, operation parameter information corresponding to the operation method, the method further comprises: in response to receiving an operation request sent by a terminal device, calling an operation method corresponding to the operation request to obtain an operation request result; sending the operation request result to the terminal device.

3. The method of claim 1, wherein, The step of determining, according to the data driving object identifier, each operation listener object identifier of a data driving object corresponding to the data driving object identifier, comprises: obtaining a listening association object corresponding to the data driving object identifier, wherein the listening association object corresponding to the data driving object identifier is an array object, and at least one operation listener object identifier is stored in the array object; determining each operation listener object identifier stored in the listening association object as each operation listener object identifier corresponding to the data driving object.

4. The method of claim 3, wherein, The method further comprises: in response to detecting operation listener object addition information corresponding to the data driving object, adding an operation listener object identifier included in the operation listener object addition information to the array object to update the array object.

5. The method of claim 1, wherein, Before the step of determining, in response to determining that a data driving object intercepts an operation method called in response to an operation request, operation parameter information corresponding to the operation method, the method further comprises: obtaining data driving class information of the data driving object; obtaining a listening identifier of a data driving class of the data driving object according to the data driving class information; in response to determining that the listening identifier represents that it is not listened to, obtaining a method identifier set of the data driving class; for each method identifier in the method identifier set, performing the following steps: obtaining an operation selector corresponding to the method identifier; determining whether the method identifier satisfies a preset operation method condition according to the operation selector; in response to determining that the method identifier satisfies the preset operation method condition, intercepting a method corresponding to the method identifier.

6. The method according to one of claims 1 to 5, wherein The method further comprises: determining a context object corresponding to the data-driven object, wherein the context object corresponds to a data-driven object identifier set containing a data-driven object identifier of the data-driven object; in response to detecting consumer registration information corresponding to the context object, creating a consumer object according to the consumer registration information, wherein the consumer object can access data-driven objects corresponding to respective data-driven object identifiers in the data-driven object identifier set.

7. The method of claim 6, wherein, The method further includes: associating the context object and the consumer object, so that the context object is associated as a context association object of the consumer object.

8. The method of claim 6, wherein, The method further includes: in response to detecting sub-object registration information corresponding to the consumer object, creating a consumer sub-object according to the sub-object registration information, wherein the consumer sub-object can access data-driven objects corresponding to respective data-driven object identifiers in the data-driven object identifier set.

9. The method of claim 8, wherein, The method further includes: in response to detecting modification information of the consumer object or the consumer sub-object to the context object, modifying the context object according to the modification information to update the context object.

10. A data-driven apparatus, comprising: a first determining unit configured to determine operation parameter information corresponding to an operation method in response to determining that a data-driven object intercepts the operation method called in response to an operation request, wherein the operation parameter information includes operation method parameter information and a data-driven object identifier of the data-driven object; a generating unit configured to generate operation parameter object information according to the data-driven object identifier, the operation method parameter information, and an operation selector of the operation method; a second determining unit configured to determine respective operation listener object identifiers of a data-driven object corresponding to the data-driven object identifier according to the data-driven object identifier, wherein each operation listener object identifier corresponds to an operation listener object corresponding to a callback method, and a return result of the callback method includes operation object information; an input unit configured to input the operation parameter object information as an input parameter to the callback method corresponding to each operation listener object identifier to notify operation object information returned by the callback method to a consumer object corresponding to the operation listener object identifier.

11. An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-9.

12. A computer readable medium having stored thereon a computer program, wherein, The program is executed by the processor to implement the method of any one of claims 1-9.

13. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-9.

13. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • A method, apparatus, terminal device, and storage medium for listen to an application startup flow

    CN109308241A

  • Operation event processing method and device, electronic equipment and storage medium

    CN114721787A