Search

CN-120469668-B - Application program generation method and device, electronic equipment and storage medium

CN120469668BCN 120469668 BCN120469668 BCN 120469668BCN-120469668-B

Abstract

The embodiment of the invention provides an application program generation method, an application program generation device, electronic equipment and a storage medium, wherein a main control class and an external capability type of the main control class are determined; the method comprises the steps of establishing an interface class based on the external capability type, determining a sub-control class aiming at the main control class and a general function type of the sub-control class, establishing an expansion base class based on the general function, establishing an association relation between the main control class and the sub-control class based on the interface class and the expansion base class, generating an application program based on the association relation, determining the responsibility of the main control class and the sub-control class by defining the association relation between the main control class and the sub-control class through the interface class and the expansion base class, realizing decoupling of the main control class and the sub-control class, and improving maintainability, expandability and development efficiency of the application program in a research and development stage.

Inventors

  • ZENG ZHONGGUANG
  • ZHANG ZHONGHUA

Assignees

  • 粤港澳大湾区(广东)国创中心

Dates

Publication Date
20260508
Application Date
20250424

Claims (9)

  1. 1. An application generation method, comprising: Determining a main control class and an external capability type of the main control class, wherein the external capability type is a function and a service provided by the main control class to a sub-control class; The interface class is a capability interface provided by a definition main control class to a sub control class and is used for defining a method and an attribute which the main control class should realize; determining a sub-control class aiming at the main control class and a general function type of the sub-control class, wherein the general function type is a general specification to be followed by the sub-control class; Constructing an expansion base class based on the general function, wherein the expansion base class is used for defining interfaces which the sub control class must realize; constructing an association relation between the main control class and the sub control class based on the interface class and the expansion base class, and generating an application program based on the association relation; The step of constructing the association relationship between the main control class and the sub control class based on the interface class and the expansion base class comprises the following steps: determining sub-control class interface type information of the sub-control class based on the interface class; constructing an initial registry for the child control class; The sub control class and the interface type information of the sub control class inherited to the expansion base class are added to the initial registry to generate a sub control class registry, the sub control class registry is used for expressing the association relation between the main control class and the sub control class, and the registration content of the sub control class registry comprises a sub control class identifier, a sub control class instance or class type, sub control class configuration information and sub control class priority.
  2. 2. The method as recited in claim 1, further comprising: Determining a target sub-control class; Controlling the main control class to read the sub-control class registry to obtain a target interface class of the target sub-control class; and calling the target sub-control class through the target interface class.
  3. 3. The method as recited in claim 2, further comprising: when the new sub control class inherited to the expansion base class is acquired, determining new sub control class interface type information of the new sub control class based on the interface class; and adding the new sub-control class and the interface type information of the new sub-control class to the sub-control class registry.
  4. 4. A method according to claim 3, further comprising: determining the new sub control class as a new main control class, and determining a new external capacity type of the new main control class; Constructing a new interface class based on the new external capability type; determining a grandchild control class for the newly added master control class and a general function type of the grandchild control class; constructing a new expansion base class based on the general function; And constructing a new association relation between the new added main control class and the grandchild control class based on the new added interface class and the new added expansion base class, and generating an application program based on the association relation and the added association relation.
  5. 5. A method as recited in claim 4, wherein the step of constructing a new association of the new grandchild control class and the new add-on control class based on the new add-on interface class and the new add-on extension base class comprises: Determining grandchild control class interface type information of the grandchild control class based on the newly added interface class; constructing a new initial registry for the grandchild control class; and adding the grandchild control class and the grandchild control class interface type information inherited to the new added expansion base class to the new added initial registry to generate a grandchild control class registry, wherein the grandchild control class registry is used for expressing the association relation between the new added main control class and the grandchild control class.
  6. 6. The method as recited in claim 5, further comprising: determining a target grandchild control class; controlling the newly added main control class to read the grandchild control class registry to obtain a newly added target interface class of the target grandchild control class; And calling the target grandchild control class through the newly added target interface class.
  7. 7. An application generation apparatus, comprising: The system comprises a main control class determining module, a main control class determining module and a main control class determining module, wherein the main control class determining module is used for determining a main control class and an external capability type of the main control class, and the external capability type is a function and a service provided by the main control class to a sub-control class; the interface class is used for defining a capability interface provided by a main control class for a sub-control class and defining a method and an attribute which the main control class should realize; The sub control class determining module is used for determining a sub control class aiming at the main control class and a general function type of the sub control class, wherein the general function type is a general specification to be followed by the sub control class; The expansion base class construction module is used for constructing an expansion base class based on the general function, wherein the expansion base class is used for defining interfaces which the sub control class must realize; The incidence relation construction module is used for constructing incidence relation between the main control class and the sub control class based on the interface class and the expansion base class and generating an application program based on the incidence relation, and is further used for determining sub control class interface type information of the sub control class based on the interface class, constructing an initial registry aiming at the sub control class, adding the sub control class and the sub control class interface type information inherited to the expansion base class to the initial registry to generate a sub control class registry, wherein the sub control class registry is used for expressing the incidence relation between the main control class and the sub control class, and the registration content of the sub control class registry comprises a sub control class identifier, a sub control class instance or class type, sub control class configuration information and sub control class priority.
  8. 8. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used for storing a computer program; The processor is configured to implement the method according to any one of claims 1-6 when executing a program stored on a memory.
  9. 9. A computer-readable storage medium having instructions stored thereon, which when executed by one or more processors, cause the processors to perform the method of any of claims 1-6.

Description

Application program generation method and device, electronic equipment and storage medium Technical Field The present invention relates to the field of software development, and in particular, to an application program generating method, an application program generating device, an electronic device, and a computer readable storage medium. Background In the development of applications, it is common to involve the management of global and local relationships, for example, a program interface contains many sub-controllers, a sub-controller contains many sub-controllers, and so on, a tree is generated, and this organization is performed in such a way that, even though the class (object) is divided according to explicit responsibilities, the class (object) has a coupling relationship with the class (object) and extends to the root node. All nodes of the entire tree are affected whenever one of the classes changes and modifies. Disclosure of Invention Embodiments of the present invention provide an application program generating method, apparatus, electronic device, and computer-readable storage medium to overcome or at least partially solve the above-described problems. The embodiment of the invention discloses an application program generation method, which comprises the following steps: determining a main control class and an external capability type of the main control class; constructing an interface class based on the external capability type; Determining a sub control class for the main control class and a general function type of the sub control class; constructing an expansion base class based on the general function; and constructing an association relation between the main control class and the sub control class based on the interface class and the expansion base class, and generating an application program based on the association relation. Optionally, the step of constructing the association relationship between the main control class and the sub control class based on the interface class and the extension base class includes: determining sub-control class interface type information of the sub-control class based on the interface class; constructing an initial registry for the child control class; and adding the sub control class and the sub control class interface type information inherited to the expansion base class to the initial registry to generate a sub control class registry, wherein the sub control class registry is used for expressing the association relation between the main control class and the sub control class. Optionally, the method further comprises: Determining a target sub-control class; Controlling the main control class to read the sub-control class registry to obtain a target interface class of the target sub-control class; and calling the target sub-control class through the target interface class. Optionally, the method further comprises: when the new sub control class inherited to the expansion base class is acquired, determining new sub control class interface type information of the new sub control class based on the interface class; and adding the new sub-control class and the interface type information of the new sub-control class to the sub-control class registry. Optionally, the method further comprises: determining the new sub control class as a new main control class, and determining a new external capacity type of the new main control class; Constructing a new interface class based on the new external capability type; determining a grandchild control class for the newly added master control class and a general function type of the grandchild control class; constructing a new expansion base class based on the general function; And constructing a new association relation between the new added main control class and the grandchild control class based on the new added interface class and the new added expansion base class, and generating an application program based on the association relation and the added association relation. Optionally, the step of constructing the new association relationship between the new added master control class and the grandchild control class based on the new added interface class and the new added extension base class includes: Determining grandchild control class interface type information of the grandchild control class based on the newly added interface class; constructing a new initial registry for the grandchild control class; and adding the grandchild control class and the grandchild control class interface type information inherited to the new added expansion base class to the new added initial registry to generate a grandchild control class registry, wherein the grandchild control class registry is used for expressing the association relation between the new added main control class and the grandchild control class. Optionally, the method further comprises: determining a target grandchild control class; controlling the newly added