CN113110873A - Method and apparatus for unifying system coding specifications - Google Patents

Method and apparatus for unifying system coding specifications Download PDF

Info

Publication number
CN113110873A
CN113110873A CN202110507422.8A CN202110507422A CN113110873A CN 113110873 A CN113110873 A CN 113110873A CN 202110507422 A CN202110507422 A CN 202110507422A CN 113110873 A CN113110873 A CN 113110873A
Authority
CN
China
Prior art keywords
mapping
coding specification
class
coding
file
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.)
Pending
Application number
CN202110507422.8A
Other languages
Chinese (zh)
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.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202110507422.8A priority Critical patent/CN113110873A/en
Publication of CN113110873A publication Critical patent/CN113110873A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/72Code refactoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation

Landscapes

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

Abstract

The invention discloses a method and a device for unifying system coding specifications, and relates to the technical field of automatic program design. One embodiment of the method comprises: partitioning a system file of a target system based on a first encoding specification into a plurality of classes; determining a mapping relation between a first coding specification and a second coding specification; and mapping the files of the multiple categories according to the mapping relation to obtain the system file which accords with the second coding specification. The implementation method can automatically modify the system code file, greatly reduce the workload and the testing pressure of manual operation, and quickly and stably unify the coding specification.

Description

Method and apparatus for unifying system coding specifications
Technical Field
The present invention relates to the field of automatic programming technology, and in particular, to a method and apparatus for unifying system coding specifications.
Background
In different scene systems, different coding/code specifications are usually set, but in practice, it is inevitable that a developer does not write code according to the specifications. Alternatively, when the code specification configured in the system is updated, the modification requirement is generated for the on-line project or the existing code. In the prior art, the coding specification of a system is generally unified by adopting a manual mode, the modification workload is large, the code collaborative modification difficulty is large, and the modification defect rate is high.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for unifying system coding specifications, which can automatically modify a system code file, greatly reduce workload and test pressure of manual operations, and quickly and stably unify coding specifications.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method for unifying systematic coding specifications, including:
partitioning a system file of a target system based on a first encoding specification into a plurality of classes;
determining a mapping relation between a first coding specification and a second coding specification;
and mapping the files of the multiple categories according to the mapping relation to obtain the system file which accords with the second coding specification.
Optionally, the plurality of categories comprises: external interfaces and non-external interfaces;
and mapping the files of multiple categories according to the mapping relation, wherein the mapping process comprises the following steps: and mapping the file of the non-external interface class according to the mapping relation.
Optionally, determining a mapping relationship between the first coding specification and the second coding specification includes:
and collecting entity names and attribute names in the system file based on the first coding specification, determining target entity names and target attribute names of the entity names and the attribute names under the second coding specification, and obtaining entity name mapping relations and attribute name mapping relations between the first coding specification and the second coding specification.
Optionally, determining a mapping relationship between the first coding specification and the second coding specification includes:
collecting entity names and attribute names in a system file based on a first coding specification, segmenting the entity names and the attribute names according to a hump rule to obtain a unit word set, determining a target unit word of each unit word in the unit word set under a second coding specification, and obtaining a mapping relation between the first coding specification and the second coding specification.
Optionally, the non-external interface class includes: a service entity class;
and mapping the file of the non-external interface class, wherein the mapping process comprises the following steps: and mapping the data structure document of the business entity class.
Optionally, the mapping process is performed on the data structure document of the business entity class, and includes:
mapping the first business entity design rule document based on the first coding specification according to the mapping relation to obtain a second business entity design rule document based on a second coding specification; and analyzing the data structure document of the service entity class by using a freemarker according to the second service entity design rule document to obtain the data structure document of the service entity class based on the second coding specification.
Optionally, the non-external interface class includes: data object and database structure classes;
and mapping the file of the non-external interface class, wherein the mapping process comprises the following steps: and mapping the data object and the data structure document of the database structure class.
Optionally, the non-external interface class includes: a system service construction class;
and mapping the file of the non-external interface class, wherein the mapping process comprises the following steps: abstracting the code file of the system service construction class into a syntax tree, and mapping the entity name and the attribute name in the code file according to the syntax tree.
Optionally, the method further comprises: preprocessing the code file of the system service building class before abstracting the code file of the system service building class into a syntax tree.
Optionally, the non-external interface class includes: a data class;
and mapping the file of the non-external interface class, wherein the mapping process comprises the following steps: and analyzing whether the files of the data classes depend on a first coding specification, and if so, mapping the files of the data classes according to the mapping relation.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for unifying systematic coding specifications, including:
the system segmentation module is used for segmenting a system file of a target system based on a first coding specification into a plurality of categories;
the mapping determining module is used for determining the mapping relation between the first coding specification and the second coding specification;
and the mapping processing module is used for mapping the files of multiple categories according to the mapping relation to obtain the system file which accords with the second coding specification.
Optionally, the plurality of categories comprises: external interfaces and non-external interfaces;
the mapping processing module performs mapping processing on the files of multiple categories according to the mapping relation, and the mapping processing module comprises the following steps: and mapping the file of the non-external interface class according to the mapping relation.
Optionally, the mapping determining module determines a mapping relationship between the first coding specification and the second coding specification, including: and collecting entity names and attribute names in the system file based on the first coding specification, determining target entity names and target attribute names of the entity names and the attribute names under the second coding specification, and obtaining entity name mapping relations and attribute name mapping relations between the first coding specification and the second coding specification.
Optionally, the mapping determining module determines a mapping relationship between the first coding specification and the second coding specification, including: collecting entity names and attribute names in a system file based on a first coding specification, segmenting the entity names and the attribute names according to a hump rule to obtain a unit word set, determining a target unit word of each unit word in the unit word set under a second coding specification, and obtaining a mapping relation between the first coding specification and the second coding specification.
Optionally, the non-external interface class includes: a service entity class;
the mapping processing module performs mapping processing on the file of the non-external interface class, and the mapping processing module comprises: and mapping the data structure document of the business entity class.
Optionally, the mapping processing module performs mapping processing on the data structure document of the service entity class, including:
mapping the first business entity design rule document based on the first coding specification according to the mapping relation to obtain a second business entity design rule document based on a second coding specification; and analyzing the data structure document of the service entity class by using a freemarker according to the second service entity design rule document to obtain the data structure document of the service entity class based on the second coding specification.
Optionally, the non-external interface class includes: data object and database structure classes;
the mapping processing module performs mapping processing on the file of the non-external interface class, and the mapping processing module comprises: and mapping the data object and the data structure document of the database structure class.
Optionally, the non-external interface class includes: a system service construction class;
the mapping processing module performs mapping processing on the file of the non-external interface class, and the mapping processing module comprises: abstracting the code file of the system service construction class into a syntax tree, and mapping the entity name and the attribute name in the code file according to the syntax tree.
Optionally, the mapping processing module is further configured to: preprocessing the code file of the system service building class before abstracting the code file of the system service building class into a syntax tree.
Optionally, the non-external interface class includes: a data class;
the mapping processing module performs mapping processing on the file of the non-external interface class, and the mapping processing module comprises: and analyzing whether the files of the data classes depend on a first coding specification, and if so, mapping the files of the data classes according to the mapping relation.
According to a third aspect of the embodiments of the present invention, there is provided an electronic device for unifying systematic coding specifications, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method provided by the first aspect of the embodiments of the present invention.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method provided by the first aspect of embodiments of the present invention.
One embodiment of the above invention has the following advantages or benefits: by determining the mapping relation between the first coding specification and the second coding specification, the system code file can be automatically modified, the workload and the testing pressure of manual operation are greatly reduced, and the coding specifications are unified quickly and stably; by dividing the system file of the target system into a plurality of categories, the files of all the categories can be modified in a targeted manner, and the stability and efficiency of the unified coding specification are further improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic main flow chart of a method for unifying systematic encoding specifications according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of system partitioning in an alternative embodiment of the present invention;
FIG. 3 is a diagram of a system for performing a mapping process in an alternate embodiment of the invention;
FIG. 4 is a flow diagram of a unified systematic coding specification in an alternative embodiment of the present invention;
FIG. 5 is a flowchart illustrating a process for mapping a file of a system service build class in an alternative embodiment of the invention;
FIG. 6 is a schematic diagram of the main modules of an apparatus for unifying systematic coding specifications according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
According to an aspect of an embodiment of the present invention, a method for unifying systematic coding specifications is provided.
Fig. 1 is a schematic main flow diagram of a method for unifying systematic coding specifications according to an embodiment of the present invention, and as shown in fig. 1, the method for unifying systematic coding specifications according to the embodiment of the present invention includes:
step S101, dividing a system file of a target system based on a first coding specification into a plurality of categories;
step S102, determining a mapping relation between a first coding specification and a second coding specification;
and step S103, mapping the files of the multiple categories according to the mapping relation to obtain a system file which accords with a second coding specification.
The division mode of the target system can be selectively set according to the actual situation, for example, the division mode is divided according to the creator of the system file. Fig. 2 is a schematic diagram of system partitioning in an alternative embodiment of the present invention, which is divided into five categories, i.e., external interface (VO), business entity (BO), data object/database structure (PO), data, and system service component, according to the function of the system file, as shown in fig. 2. By dividing the system file of the target system into a plurality of categories, the files of all the categories can be modified conveniently in a targeted manner, and the stability and efficiency of the unified coding specification are improved.
The mapping relation refers to the corresponding relation between the code form of the same element under the first coding specification and the code form of the same element under the second coding specification. By determining the mapping relation between the first coding specification and the second coding specification, the system code file can be automatically modified, the workload and the testing pressure of manual operation are greatly reduced, and the coding specifications are unified quickly and stably.
In some embodiments, the entity name and the attribute name in the system file based on the first encoding specification may be collected, and the target entity name and the target attribute name of the entity name and the attribute name under the second encoding specification may be determined, so as to obtain the entity name mapping relationship and the attribute name mapping relationship between the first encoding specification and the second encoding specification. In this embodiment, the mapping relationship is performed based on each attribute, and a correspondence relationship between a code form of each attribute in the first encoding specification and a code form of each attribute in the second encoding specification is embodied. Table 1 shows an example of a mapping relationship structure, and in table 1, new and old refer to a coding specification, respectively.
TABLE 1 mapping relationship Structure
Old object name Old attribute name Name of new object New attribute name
Loan Acctno LoanInfo ActNo
In other embodiments, the entity names and the attribute names in the system file based on the first coding specification are collected, the entity names and the attribute names are segmented according to a hump rule (a naming rule in programming, when a variable name or a function name is a unique identification word formed by linking one or more words, the first word starts with a lower case letter, the first letter of the second word is capitalized, or the first letter of each word adopts a capital letter) to obtain a unit word set, and a target unit word of each unit word in the unit word set under the second coding specification is determined to obtain an entity name mapping relationship and an attribute name mapping relationship between the first coding specification and the second coding specification.
Fig. 3 is a diagram illustrating a mapping process performed in the system according to an alternative embodiment of the present invention. In this embodiment, the unit word mapping relationship is: aa → Dd, Bb → Ee, Cc → Ff. And mapping the attribute name AaBbCC in the system according to the mapping relation to obtain a new attribute name DdEeFf.
In this embodiment, the mapping relationship is performed not on the basis of each attribute, but on the basis of the unit words, which reflects the correspondence between the code form of each unit word under the first coding specification and the code form of each unit word under the second coding specification, and the set of mapping relationships is smaller, thereby facilitating the rapid establishment of the mapping relationship between the first coding specification and the second coding specification.
Optionally, the system file is divided into an external interface class and a non-external interface class. The external interface is the part of the system related to the external system. The non-external interface class refers to a system file except the external interface class in the system file. Since the external interface class is a part of the system associated with the external system, the part is usually unchangeable and is not subjected to mapping processing. When the files of a plurality of types are mapped according to the mapping relation, the files of the non-external interface type are mapped only according to the mapping relation, so that the influence on the communication between the target system and the external system can be avoided.
Optionally, the non-external interface class includes: a class of business entities. The files of the business entity class do not contain any business logic, so that the data structure documents of the business entity class can be directly mapped when the files of the non-external interface class are mapped. In the actual application process, the business entity can be specified, so that the business object only contains data and a getter/setter method. Optionally, when the data structure document of the service entity class is mapped, the first service entity design rule document based on the first coding specification may be mapped according to the mapping relationship to obtain the second service entity design rule document based on the second coding specification, and then the data structure document of the service entity class is analyzed according to the second service entity design rule document by using a freemarker to obtain the data structure document of the service entity class based on the second coding specification. The first business entity design rule document refers to a document of a business entity coding rule conforming to a first coding specification, and the second business entity design rule document refers to a document of a business entity coding rule conforming to a second coding specification. And a freemarker template engine is used for regenerating the business entity, so that the efficiency is high.
Optionally, the non-external interface classes include data object and database structure classes. The mapping processing of the file of the non-external interface class comprises the following steps: and mapping the data object and the data structure document of the database structure class. The part mainly deals with the problem that the database table name, the column name and the data are not compatible with a target system due to the application of the naming rule modification.
Optionally, the non-external interface class comprises a system services build class. The mapping processing of the file of the non-external interface class comprises the following steps: abstracting the code file of the system service construction class into a syntax tree, and mapping the entity name and the attribute name in the code file according to the syntax tree. The attribute replacement is carried out by operating the syntax tree, so that the method can be repeatedly executed, the adjustment is convenient after the coding specification is evaluated, the codes are not manually modified, the workload is small, and the defect rate is low.
Illustratively, the alternate range of elements at the time of the mapping process is first specified: an import part, wherein the import part comprises an entity object name; a class name; forming a general type; an attribute type; a method parameter type; a method parameter type; a local variable type; the method returns a value type; an attribute name; a method parameter name; a local variable name; the name of the method; a string constant; and (6) annotating. Fig. 5 is a schematic flowchart of mapping a file of a system service building class in an alternative embodiment of the present invention, and as shown in fig. 5, the method includes the following steps:
step S501, syntax tree analysis.
Step S502, scanning the syntax tree, inquiring the mapping relation by taking the import, the class name and the generic as keys, and if the mapping relation is matched, modifying the current import, the class name and the generic.
And step S503, mapping the attribute type, the method parameter type and the local variable type.
Step S504, the variable mapping process of the current action domain.
Scanning all variables in the syntax tree to establish a data structure as shown in the following table 2, inquiring the mapping relation by taking the type name as a Key, modifying the type name if the mapping relation is matched, and triggering and modifying all variables under the current action domain of the type when the type name is modified. The modification path is as follows: if only one variable exists under the type current action domain, directly modifying the variable name into a type name (initial lower case); if there are more variables under the type of current scope, an alternative modification is used. For example, A aTmp is modified to B bTmp.
Table 2 data structure of variables
Class path Name of type Attribute name/local variable name Scope of action
a.b.c D d Class (D)
a.b.c F f Name of method ()
And S505, scanning all methods meeting the beginning of Set/Get in the syntax tree, acquiring the type of a method calling party, inquiring the mapping relation by taking the type name and the Set method as a Key, and modifying the method name if the type name and the Set method are matched.
And step S506, carrying out normal lighting on the method name and the character string and carrying out annotation mapping processing.
And scanning the syntax tree to obtain a method name, a character string constant and an annotation. And then performing mapping processing by using the mapping relation. For example, if there is a mapping a < ═ B, then the method queryA is modified to queryB.
And step S507, personalized processing. For example, the following scenarios are mainly handled: special syntax, collection object, doc annotation.
Optionally, the code file of the system service build class is preprocessed before the code file of the system service build class is abstracted into the syntax tree. The embodiment can standardize the code format of the business object and reduce the difficulty of syntactic analysis. For example, an express import part, which is used to express the file context, cannot be used. For another example, the java version of the code is standardized, so that special grammar is reduced, and the grammar parsing difficulty is reduced.
Optionally, the non-external interface class includes: a data class; the method for mapping the file of the non-external interface class comprises the following steps: and analyzing whether the files of the data classes depend on the first coding specification, and if so, mapping the files of the data classes according to the mapping relation. For example, whether the data includes a class name and an attribute name. For example, other special processing is performed.
In the embodiment of the present invention, the order of mapping processing for the class files such as the business entity (BO), the data object/database structure (PO), the data, and the system service component may be selectively set according to the actual situation, or may be executed simultaneously, which is not limited in the present invention. Fig. 4 is a flow diagram of a unified systematic coding specification in an alternative embodiment of the present invention. As shown in fig. 4, the flow of the unified systematic encoding specification includes: step S401, system segmentation; step S402, determining entity/attribute mapping relation; step S403, preprocessing a system service construction class; step S404, mapping the service entity class; step S405, the system service constructs grammar analysis; step S406, system service construction class reference replacement; step S407, mapping the data object, the database structure class and the data class; and step S408, manual correction. For the detailed description of each step, reference may be made to the foregoing description, and details are not described herein.
According to the embodiment of the invention, the mapping relation between the first coding specification and the second coding specification is determined, so that the system code file can be automatically modified, the workload and the testing pressure of manual operation are greatly reduced, and the coding specifications are unified quickly and stably; by dividing the system file of the target system into a plurality of categories, the files of all the categories can be modified in a targeted manner, and the stability and efficiency of the unified coding specification are further improved.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for implementing the above method.
Fig. 6 is a schematic diagram of main blocks of an apparatus for unifying systematic coding specifications according to an embodiment of the present invention. As shown in fig. 6, the apparatus 600 for unifying systematic coding specifications includes:
a system partitioning module 601, for partitioning the system file of the target system based on the first encoding specification into a plurality of categories;
a mapping determining module 602, configured to determine a mapping relationship between a first encoding specification and a second encoding specification;
and the mapping processing module 603 performs mapping processing on the multiple types of files according to the mapping relationship to obtain a system file meeting the second encoding specification.
Optionally, the plurality of categories comprises: external interfaces and non-external interfaces;
the mapping processing module performs mapping processing on the files of multiple categories according to the mapping relation, and the mapping processing module comprises the following steps: and mapping the file of the non-external interface class according to the mapping relation.
Optionally, the mapping determining module determines a mapping relationship between the first coding specification and the second coding specification, including: and collecting entity names and attribute names in the system file based on the first coding specification, determining target entity names and target attribute names of the entity names and the attribute names under the second coding specification, and obtaining entity name mapping relations and attribute name mapping relations between the first coding specification and the second coding specification.
Optionally, the mapping determining module determines a mapping relationship between the first coding specification and the second coding specification, including: collecting entity names and attribute names in a system file based on a first coding specification, segmenting the entity names and the attribute names according to a hump rule to obtain a unit word set, determining a target unit word of each unit word in the unit word set under a second coding specification, and obtaining a mapping relation between the first coding specification and the second coding specification.
Optionally, the non-external interface class includes: a service entity class;
the mapping processing module performs mapping processing on the file of the non-external interface class, and the mapping processing module comprises: and mapping the data structure document of the business entity class.
Optionally, the mapping processing module performs mapping processing on the data structure document of the service entity class, including:
mapping the first business entity design rule document based on the first coding specification according to the mapping relation to obtain a second business entity design rule document based on a second coding specification; and analyzing the data structure document of the service entity class by using a freemarker according to the second service entity design rule document to obtain the data structure document of the service entity class based on the second coding specification.
Optionally, the non-external interface class includes: data object and database structure classes;
the mapping processing module performs mapping processing on the file of the non-external interface class, and the mapping processing module comprises: and mapping the data object and the data structure document of the database structure class.
Optionally, the non-external interface class includes: a system service construction class;
the mapping processing module performs mapping processing on the file of the non-external interface class, and the mapping processing module comprises: abstracting the code file of the system service construction class into a syntax tree, and mapping the entity name and the attribute name in the code file according to the syntax tree.
Optionally, the mapping processing module is further configured to: preprocessing the code file of the system service building class before abstracting the code file of the system service building class into a syntax tree.
Optionally, the non-external interface class includes: a data class;
the mapping processing module performs mapping processing on the file of the non-external interface class, and the mapping processing module comprises: and analyzing whether the files of the data classes depend on a first coding specification, and if so, mapping the files of the data classes according to the mapping relation.
According to a third aspect of the embodiments of the present invention, there is provided an electronic device for unifying systematic coding specifications, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method provided by the first aspect of the embodiments of the present invention.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method provided by the first aspect of embodiments of the present invention.
Fig. 7 illustrates an exemplary system architecture 700 to which the method of unifying systematic coding specifications or the apparatus of unifying systematic coding specifications of embodiments of the present invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. The terminal devices 701, 702, 703 may have installed thereon various communication client applications, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only).
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 701, 702, 703. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for unifying the systematic code specification provided by the embodiment of the present invention is generally executed by the server 705, and accordingly, the apparatus for unifying the systematic code specification is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the 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 computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present invention, 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 invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart 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 invention. 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 or flowchart illustration, and combinations of blocks in the block diagrams 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 modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprising: the system comprises a system segmentation module, a mapping determination module and a mapping processing module. The names of these modules do not in some cases form a limitation on the modules themselves, and for example, the system partitioning module may also be described as a "module that performs mapping processing on files of multiple categories according to the mapping relationship".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: partitioning a system file of a target system based on a first encoding specification into a plurality of classes; determining a mapping relation between a first coding specification and a second coding specification; and mapping the files of the multiple categories according to the mapping relation to obtain the system file which accords with the second coding specification.
According to the technical scheme of the embodiment of the invention, the system code file can be automatically modified by determining the mapping relation between the first coding specification and the second coding specification, so that the workload and the testing pressure of manual operation are greatly reduced, and the coding specifications are unified quickly and stably; by dividing the system file of the target system into a plurality of categories, the files of all the categories can be modified in a targeted manner, and the stability and efficiency of the unified coding specification are further improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (16)

1. A method of unifying system coding specifications, comprising:
partitioning a system file of a target system based on a first encoding specification into a plurality of classes;
determining a mapping relation between a first coding specification and a second coding specification;
and mapping the files of the multiple categories according to the mapping relation to obtain the system file which accords with the second coding specification.
2. The method of claim 1, wherein the plurality of categories comprise: external interfaces and non-external interfaces;
and mapping the files of multiple categories according to the mapping relation, wherein the mapping process comprises the following steps: and mapping the file of the non-external interface class according to the mapping relation.
3. The method of claim 2, wherein determining the mapping relationship between the first coding specification and the second coding specification comprises:
and collecting entity names and attribute names in the system file based on the first coding specification, determining target entity names and target attribute names of the entity names and the attribute names under the second coding specification, and obtaining entity name mapping relations and attribute name mapping relations between the first coding specification and the second coding specification.
4. The method of claim 2, wherein determining the mapping relationship between the first coding specification and the second coding specification comprises:
collecting entity names and attribute names in a system file based on a first coding specification, segmenting the entity names and the attribute names according to a hump rule to obtain a unit word set, determining a target unit word of each unit word in the unit word set under a second coding specification, and obtaining a mapping relation between the first coding specification and the second coding specification.
5. The method of claim 3, wherein the non-external interface class comprises: a service entity class;
and mapping the file of the non-external interface class, wherein the mapping process comprises the following steps: and mapping the data structure document of the business entity class.
6. The method of claim 5, wherein mapping the data structure document of the business entity class comprises:
mapping the first business entity design rule document based on the first coding specification according to the mapping relation to obtain a second business entity design rule document based on a second coding specification; and analyzing the data structure document of the service entity class by using a freemarker according to the second service entity design rule document to obtain the data structure document of the service entity class based on the second coding specification.
7. The method of claim 3, wherein the non-external interface class comprises: data object and database structure classes;
and mapping the file of the non-external interface class, wherein the mapping process comprises the following steps: and mapping the data object and the data structure document of the database structure class.
8. The method of claim 3, wherein the non-external interface class comprises: a system service construction class;
and mapping the file of the non-external interface class, wherein the mapping process comprises the following steps: abstracting the code file of the system service construction class into a syntax tree, and mapping the entity name and the attribute name in the code file according to the syntax tree.
9. The method of claim 8, wherein the method further comprises: preprocessing the code file of the system service building class before abstracting the code file of the system service building class into a syntax tree.
10. The method of claim 3, wherein the non-external interface class comprises: a data class;
and mapping the file of the non-external interface class, wherein the mapping process comprises the following steps: and analyzing whether the files of the data classes depend on a first coding specification, and if so, mapping the files of the data classes according to the mapping relation.
11. An apparatus for unifying system coding specifications, comprising:
the system segmentation module is used for segmenting a system file of a target system based on a first coding specification into a plurality of categories;
the mapping determining module is used for determining the mapping relation between the first coding specification and the second coding specification;
and the mapping processing module is used for mapping the files of multiple categories according to the mapping relation to obtain the system file which accords with the second coding specification.
12. The apparatus of claim 11, wherein the plurality of categories comprise: external interfaces and non-external interfaces;
the mapping processing module performs mapping processing on the files of multiple categories according to the mapping relation, and the mapping processing module comprises the following steps: and mapping the file of the non-external interface class according to the mapping relation.
13. The apparatus of claim 12, wherein the mapping determination module determines a mapping relationship between a first coding specification and a second coding specification, comprising: and collecting entity names and attribute names in the system file based on the first coding specification, determining target entity names and target attribute names of the entity names and the attribute names under the second coding specification, and obtaining entity name mapping relations and attribute name mapping relations between the first coding specification and the second coding specification.
14. The apparatus of claim 12, wherein the mapping determination module determines a mapping relationship between a first coding specification and a second coding specification, comprising: collecting entity names and attribute names in a system file based on a first coding specification, segmenting the entity names and the attribute names according to a hump rule to obtain a unit word set, determining a target unit word of each unit word in the unit word set under a second coding specification, and obtaining a mapping relation between the first coding specification and the second coding specification.
15. An electronic device that unifies specifications of systematic codes, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-10.
16. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-10.
CN202110507422.8A 2021-05-10 2021-05-10 Method and apparatus for unifying system coding specifications Pending CN113110873A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110507422.8A CN113110873A (en) 2021-05-10 2021-05-10 Method and apparatus for unifying system coding specifications

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110507422.8A CN113110873A (en) 2021-05-10 2021-05-10 Method and apparatus for unifying system coding specifications

Publications (1)

Publication Number Publication Date
CN113110873A true CN113110873A (en) 2021-07-13

Family

ID=76721466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110507422.8A Pending CN113110873A (en) 2021-05-10 2021-05-10 Method and apparatus for unifying system coding specifications

Country Status (1)

Country Link
CN (1) CN113110873A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200117427A1 (en) * 2018-10-10 2020-04-16 International Business Machines Corporation Relevance of a source code change to compliance requirements
CN111209005A (en) * 2020-01-06 2020-05-29 腾讯科技(深圳)有限公司 Method and apparatus for compiling program file, and computer-readable storage medium
CN111708539A (en) * 2020-06-17 2020-09-25 腾讯科技(深圳)有限公司 Application program code conversion method and device, electronic equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200117427A1 (en) * 2018-10-10 2020-04-16 International Business Machines Corporation Relevance of a source code change to compliance requirements
CN111209005A (en) * 2020-01-06 2020-05-29 腾讯科技(深圳)有限公司 Method and apparatus for compiling program file, and computer-readable storage medium
CN111708539A (en) * 2020-06-17 2020-09-25 腾讯科技(深圳)有限公司 Application program code conversion method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN107832045B (en) Method and apparatus for cross programming language interface conversion
CN107203574B (en) Aggregation of data management and data analysis
CN107491382B (en) Log output method and device
CN112527649A (en) Test case generation method and device
CN110020358B (en) Method and device for generating dynamic page
CN110689268A (en) Method and device for extracting indexes
CN113760948A (en) Data query method and device
CN114091426A (en) Method and device for processing field data in data warehouse
CN111125064A (en) Method and device for generating database mode definition statement
CN114116065A (en) Method and device for acquiring topological graph data object and electronic equipment
CN116244387A (en) Entity relationship construction method, device, electronic equipment and storage medium
CN113190517B (en) Data integration method and device, electronic equipment and computer readable medium
CN113448869B (en) Method and device for generating test case, electronic equipment and computer readable medium
CN113626223A (en) Interface calling method and device
CN111339743B (en) Account number generation method and device
CN112559024A (en) Method and device for generating transaction code change list
CN116204428A (en) Test case generation method and device
CN110705271A (en) System and method for providing natural language processing service
CN115543428A (en) Simulated data generation method and device based on strategy template
CN115640279A (en) Method and device for constructing data blood relationship
CN113110873A (en) Method and apparatus for unifying system coding specifications
CN114625373A (en) Application conversion method and device, electronic equipment and storage medium
CN113742321A (en) Data updating method and device
CN112256566A (en) Test case preservation method and device
CN111178014A (en) Method and device for processing business process

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