CN106874019A - The generation method and skeletal code maker of a kind of skeletal code - Google Patents
The generation method and skeletal code maker of a kind of skeletal code Download PDFInfo
- Publication number
- CN106874019A CN106874019A CN201710159527.2A CN201710159527A CN106874019A CN 106874019 A CN106874019 A CN 106874019A CN 201710159527 A CN201710159527 A CN 201710159527A CN 106874019 A CN106874019 A CN 106874019A
- Authority
- CN
- China
- Prior art keywords
- skeleton
- template
- configuration item
- code
- item parameters
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000011161 development Methods 0.000 claims abstract description 37
- 238000012545 processing Methods 0.000 claims description 25
- 230000018109 developmental process Effects 0.000 description 30
- 238000012360 testing method Methods 0.000 description 21
- 238000010586 diagram Methods 0.000 description 16
- 230000006870 function Effects 0.000 description 16
- 238000004590 computer program Methods 0.000 description 9
- 230000006872 improvement Effects 0.000 description 9
- 230000008569 process Effects 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 5
- 238000013461 design Methods 0.000 description 2
- 230000008571 general function Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 239000012141 concentrate Substances 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000011022 operating instruction Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 229920001296 polysiloxane Polymers 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000033772 system development Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/33—Intelligent editors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
This application discloses the generation method and skeletal code maker of a kind of skeletal code, methods described includes:Skeleton template and the configuration item parameter based on the skeleton template configuration are obtained, wherein, the skeleton template refers to determine the corresponding skeletal code template of development mode, and the configuration item parameter is the parameter that project-based business logic development is the skeleton template configuration;The skeleton template is parsed, and corresponding operation is carried out to corresponding code in the skeleton template based on the configuration item parameter, obtain the skeletal code of the project.The method and apparatus of the embodiment of the present application, enabling to project development personnel to be operated by relatively simple parameter configuration can just generate skeletal code, greatly save the time that project development personnel write skeletal code, effectively increase the efficiency of project development.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a skeleton code generation method and a skeleton code generator.
Background
In the software development process, a framework is a reusable design of a whole or part of an application system, and is a bottom-layer service for realizing general functions in a certain application field, for example: construction mode, coding specification, implementation mode and the like. A programmer using the framework, i.e., a framework user, can initiate specific system development based on a general function that has been implemented.
In order to facilitate the framework user to develop software by using the framework, the framework developer needs to provide necessary information such as necessary configuration options, use methods, and run module contexts when developing the framework.
In the prior art, a frame user is generally provided with a use method and configuration information of a certain function module in a frame document mode, and the frame user needs to write frame skeleton codes of application software codes according to the frame document.
However, the way of the frame document increases the learning cost of the frame user, and when the frame user is not clear enough for the frame itself to implement the mechanism, it is easy to falsely use some characteristics provided by the frame document, so that the efficiency is low when the frame-based implementation software is developed.
How to solve the problem of low efficiency in software development based on a framework in the prior art is a technical problem to be solved by the application.
Disclosure of Invention
The embodiment of the application provides a skeleton code generation method and a skeleton code generator, which are used for solving the problem of low efficiency in software development based on a framework in the prior art.
A method for generating a skeleton code comprises the following steps:
acquiring a skeleton template and configuration item parameters configured on the basis of the skeleton template, wherein the skeleton template is a skeleton code template corresponding to a specified development mode, and the configuration item parameters are parameters configured for the skeleton template on the basis of development service logic of a project;
analyzing the skeleton template, and carrying out corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters to obtain a skeleton code of the project.
Optionally, the configuration item parameters include macro replacement variables and corresponding macro replacement variable values;
performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters, specifically including: when the skeleton template is analyzed to obtain macro replacement variables, determining macro replacement variable values corresponding to the macro replacement variables from the configuration item parameters;
and replacing the macro replacement variable in the framework template with a macro replacement variable value corresponding to the macro replacement variable.
Optionally, the configuration item parameter includes an IF judgment statement, where the IF judgment statement includes an IF judgment identifier and an IF judgment result;
performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters, specifically including: when the framework template is analyzed to obtain an IF judgment identifier, determining an IF judgment result corresponding to the IF judgment identifier from the configuration item parameters;
and determining whether to generate a functional module code corresponding to the IF judgment identifier in the skeleton template in the skeleton code according to the IF judgment result.
Optionally, the configuration item parameter includes a loop variable and a corresponding loop variable value;
performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters, specifically including: when the framework template is analyzed to obtain a cycle variable, determining a cycle variable value corresponding to the cycle variable from the configuration item parameters;
and replacing the loop variable in the skeleton template with a loop variable value corresponding to the loop variable to generate a loop statement in the skeleton code.
Optionally, the configuration item parameter includes a macro replacement filename, where the macro replacement filename is used to replace a filename that needs macro replacement in the skeleton template.
Optionally, the configuration item parameter includes a file name execution permission parameter, where the file name execution permission parameter is used to determine an execution permission of a file name in the skeleton template.
Optionally, the skeleton template and the configuration item parameters are stored in a file form; or,
the skeleton template and the configuration item parameters are both stored in a database.
An embodiment of the present application further provides a skeleton code generator, including: an acquisition unit and a processing unit, wherein:
the framework template configuration method comprises an acquisition unit, a configuration item parameter and a configuration item parameter, wherein the acquisition unit is used for acquiring a framework template and the configuration item parameter configured on the basis of the framework template, the framework template is a framework code template corresponding to a specified development mode, and the configuration item parameter is a parameter configured for the framework template on the basis of the development service logic of a project;
and the processing unit is used for analyzing the skeleton template and carrying out corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters to obtain the skeleton code of the project.
An embodiment of the present application further provides a skeleton code generator, including: a memory and a processor, wherein:
a memory for storing a program;
the processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
acquiring a skeleton template and configuration item parameters configured on the basis of the skeleton template, wherein the skeleton template is a skeleton code template corresponding to a specified development mode, and the configuration item parameters are parameters configured for the skeleton template on the basis of development service logic of a project;
analyzing the skeleton template, and carrying out corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters to obtain a skeleton code of the project.
The embodiment of the application adopts at least one technical scheme which can achieve the following beneficial effects:
the skeleton template is analyzed, and the corresponding processing operation is carried out on the codes in the skeleton template according to the configuration item parameters configured based on the development service logic of the project to obtain the skeleton codes, so that project developers can generate the skeleton codes through simpler parameter configuration operation, the time for the project developers to write the skeleton codes is greatly saved, and the project development efficiency is effectively improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a method for generating a skeleton code according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a skeleton code generator provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a skeleton code generator according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a skeleton code generator according to an embodiment of the present application.
Detailed Description
In order to achieve the purpose of the present application, embodiments of the present application provide a skeleton code generation method and a skeleton code generator, where a skeleton template is analyzed, and a corresponding processing operation is performed on codes in the skeleton template according to configuration item parameters configured based on a development service logic of a project to obtain skeleton codes, so that a project developer can generate skeleton codes through a relatively simple parameter configuration operation, thereby greatly saving time for the project developer to write skeleton codes, and effectively improving efficiency of project development.
The technical solutions of the present application will be described clearly and completely below with reference to the specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Example 1
Fig. 1 is a schematic flowchart of a method for generating a skeleton code according to an embodiment of the present application. The method may be as follows.
Step 101: obtaining a skeleton template and configuration item parameters configured based on the skeleton template.
The framework template is a framework code template corresponding to a specified development mode, and the configuration item parameters are parameters configured for the framework template based on the development service logic of the project.
In the embodiment of the application, a framework developer writes corresponding framework code templates (framework templates for short) in different development modes according to a framework, and sets configuration item parameters based on the framework templates.
A project developer (namely a framework user) selects a framework template corresponding to a specified mode, and configures corresponding parameter values for configuration item parameters of the framework template based on the development service logic of the project.
In the embodiment of the application, the skeleton template and the configuration item parameters are stored in a file form; or,
the skeleton template and the configuration item parameters are both stored in a database.
The project developer runs the skeleton code generator, so that the skeleton code generator obtains the skeleton template and the configuration item parameters based on the skeleton template.
In the embodiment of the present application, the configuration item parameters include, but are not limited to, a macro replacement variable and a corresponding macro replacement variable value, an IF determination statement including a determination identifier and a determination result, a loop variable and a corresponding loop variable value, a macro replacement file name, and a file name execution permission parameter.
For example, the configuration item adopts a configuration format of an INI format, in which:
the configuration items comprise project configuration items, wherein the project configuration items are used for configuring macro replacement variables and corresponding macro replacement variable values;
the configuration items comprise module configuration items, wherein the module configuration items are used for configuring IF judgment statements comprising IF judgment identifications and IF judgment results;
the configuration items comprise params configuration items, wherein the params configuration items are used for configuring the loop variables and the corresponding loop variable values;
the configuration items comprise files configuration items, wherein the files configuration items are used for configuring macro replacement file names;
the configuration items comprise execs configuration items, wherein the execs configuration items are used for configuring file name execution permission parameters.
And configuring corresponding parameter values for the configuration item parameters of the skeleton template by the project developer based on the development service logic of the project.
For example, the contents of the configuration item parameter file test.
test.ini
[project]
ADINF_PROJECT_NAME=seedTest
ADINF_PROJECT_SUMMARY=Weibo adinf seedTest
ADINF_PROJECT_URL=http://adinf.weiboad.org
ADINF_PROJECT_VENDOR=zhongxiu<zhongxiu@staff.weibo.com>
ADINF_PROJECT_PACKAGER=zhongxiu<zhongxiu@staff.weibo.com>
[module]
adserver=yes
timer=yes
kafkac=no
kafkap=no
logging=yes
[params]
timers=Test
http_controllers=Index,Test
kafka_consumers=Test
kafka_consumers_topics=test
kafka_consumers_groups=test_cpp
kafka_producers=Test
kafka_producers_topics=test
[files]
src/main.cpp=src/@ADINF_PROJECT_NAME@.cpp
rpm/main.spec.in=rpm/@ADINF_PROJECT_NAME@.spec.in
[execs]
cmake.sh=1
rpm/build_rpm.in=1
Step 102: analyzing the skeleton template, and carrying out corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters to obtain a skeleton code of the project.
In this embodiment of the application, performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameter specifically includes: when the skeleton template is analyzed to obtain macro replacement variables, determining macro replacement variable values corresponding to the macro replacement variables from the configuration item parameters;
and replacing the macro replacement variable in the framework template with a macro replacement variable value corresponding to the macro replacement variable.
The macro variable replacement function is to solve some hard-coded problems in generating skeleton code, such as: for a project with a project name of test, a project developer needs the project name when writing a code corresponding to the project. However, since the PROJECT NAME of the framework user, i.e., the PROJECT developer, cannot be predicted by the framework developer when writing the framework template, the PROJECT _ NAME variable is used as a placeholder in the framework template.
The PROJECT developer inputs the macro replacement variable value corresponding to the macro replacement variable, PROJECT _ NAME, in the PROJECT configuration item.
The skeleton code generator comprises a macro replacement variable code generator.
And the macro replacement variable code generator analyzes the skeleton template, determines a macro replacement variable value corresponding to the macro replacement variable PROJECT _ NAME from the configuration item parameters when the macro replacement variable code generator obtains the macro replacement variable PROJECT _ NAME, and executes macro replacement operation on the macro replacement variable based on the macro replacement variable value.
In the skeleton template, the syntax of the macro replacement statement is @ variable name @.
For example, the macro replacement code in the skeleton template is as follows:
#define@PROJECT_NAME|upper@_VERSION_HPP_
#define@PROJECT_NAME|upper@_VERSION_HPP
the following of |, the macro replacement code supports a simple character string conversion function, and represents that after the macro replacement variable is replaced by the corresponding macro replacement variable value, the macro replacement variable value is converted into a capital.
project configuration item parameter codes are as follows:
[project]
PROJECT_NAME=test
therefore, the macro-variable replacement code generator parses the skeleton template, and performs macro replacement operation on the macro replacement variable in the skeleton template by using the corresponding macro replacement variable value based on the project configuration item parameter code, so as to obtain the following partial codes in the skeleton code:
#define TEST_VERSION_HPP_
#define TEST_VERSION_HPP_
in this embodiment of the application, performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameter specifically includes: when the framework template is analyzed to obtain an IF judgment identifier, determining an IF judgment result corresponding to the IF judgment identifier from the configuration item parameters;
and determining whether to generate a functional module code corresponding to the IF judgment identifier in the skeleton template in the skeleton code according to the IF judgment result.
The IF determination is to enable the function module code in the skeleton template to be generated in the skeleton code by configuration.
In the skeleton template, the syntax of the IF decision is:
@IF@xxx
function module code
@ENDIF
For example, the IF decision statement in the skeleton template is as follows:
@IF@bar
echo“test bar”;
@IFEND
(1) the IF decision statements in the module configuration item parameters are as follows:
[module]
bar=yes
wherein bar represents the IF judgment mark, and yes represents the IF judgment result.
The framework code generator comprises an IF statement support code generator.
Therefore, the IF statement support code generator analyzes the skeleton template, and based on the IF judgment condition in the module configuration item parameter, obtains a part of codes in the skeleton code as follows:
echo“test bar”;
(2) the IF decision statements in the module configuration item parameters are as follows:
[module]
bar=no
wherein bar represents an IF judgment identifier, and no represents an IF judgment result.
The framework code generator comprises an IF statement support code generator.
Therefore, the IF statement support code generator parses the skeleton template, and does not generate the function module code in the skeleton code based on the IF judgment condition in the module configuration item parameter.
In this embodiment of the application, performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameter specifically includes: when the framework template is analyzed to obtain a cycle variable, determining a cycle variable value corresponding to the cycle variable from the configuration item parameters;
and replacing the loop variable in the skeleton template with a loop variable value corresponding to the loop variable to generate a loop statement in the skeleton code.
The FOR loop statement is used FOR solving the problem of generating similar codes in the skeleton code, the FOR loop statement in the skeleton template is used FOR generating the same part of the similar codes, and the loop variable in the FOR loop statement is replaced by the loop variable value corresponding to the loop variable in the configuration item parameter.
In the skeleton template, the syntax of the FOR loop statement is:
@FOR@xxx
skeleton code block
@ENDFOR
FOR example, the FOR loop statement in the skeleton template is as follows:
@FOR@bar
echo“test bar@REPLACE0@”;
echo“test bar@REPLACE1@”
@IFEND
the params configuration item parameter code is as follows:
[params]
bar=a,b
the framework code generator comprises an FOR statement support code generator.
Therefore, the FOR statement support code generator analyzes the skeleton template, and replaces the loop variable in the FOR loop statement in the skeleton code template with the corresponding loop variable value based on the params configuration item code to obtain a partial code of the skeleton code as follows:
echo“test bar a”;
echo“test bar b”;
the params configuration items are separated by commas with respect to the multiple loop variable values in the FOR loop statement.
In the FOR loop statements of the skeleton template, the @ FOR may also be followed by a number of comma-separated loop variables.
In the FOR loop statement of the skeleton template, a plurality of loop variables may be used in the loop body, FOR example, @ REPLACE0@, @ REPLACE1@, …, @ REPLACEx @ and the like.
It should be noted that the loop variable value may be a numerical value or an array, and is not limited in this respect.
As in the above example, when the loop variable values a and b each represent an array, a being [1, 2, 3] and b being [4, 5], the partial codes of the resulting skeleton code are as follows:
echo“test bar 1”;
echo“test bar 2”;
echo“test bar 3”;
echo“test bar 4”;
echo“test bar 5”;
fig. 2 is a schematic diagram of a skeleton code generator according to an embodiment of the present application.
As shown in fig. 2, the skeleton code generator includes, but is not limited to, a macro replacement variable code generator, an IF statement support code generator, a FOR statement support code generator, a statement nesting support code generator, a file name macro replacement code generator, and a file name authority configuration code generator.
Analyzing the skeleton template through each code generator contained in the skeleton code generator, and carrying out corresponding operation on the corresponding codes in the skeleton template based on the configuration item parameters to obtain the skeleton codes of the project.
A project developer can quickly generate skeleton codes through the skeleton code generator, so that the project developer can concentrate main efforts on business requirement development, and development time of general codes is saved.
According to the technical scheme, the skeleton template is analyzed, and the corresponding processing operation is performed on the codes in the skeleton template according to the configuration item parameters configured based on the development service logic of the project to obtain the skeleton codes, so that the project developers can generate the skeleton codes through simple parameter configuration operation, the time for the project developers to write the skeleton codes is greatly saved, and the project development efficiency is effectively improved.
Example 2
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 3, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads a corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the skeleton code generator on a logic level. Of course, besides the software implementation, the present application does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Fig. 4 is a schematic structural diagram of a skeleton code generator according to an embodiment of the present application. The skeleton code generator 400 includes: an acquisition unit 401 and a processing unit 402, wherein:
an obtaining unit 401, configured to obtain a skeleton template and a configuration item parameter configured based on the skeleton template, where the skeleton template is a skeleton code template corresponding to a specified development mode, and the configuration item parameter is a parameter configured for the skeleton template based on a development service logic of a project;
the processing unit 402 is configured to analyze the skeleton template, and perform a corresponding operation on a corresponding code in the skeleton template based on the configuration item parameter to obtain a skeleton code of the project.
Optionally, the configuration item parameters include macro replacement variables and corresponding macro replacement variable values;
the processing unit 402 is specifically configured to determine, when the skeleton template is analyzed to obtain a macro replacement variable, a macro replacement variable value corresponding to the macro replacement variable from the configuration item parameters;
and replacing the macro replacement variable in the framework template with a macro replacement variable value corresponding to the macro replacement variable.
Optionally, the configuration item parameter includes an IF judgment statement, where the IF judgment condition includes an IF judgment identifier and an IF judgment result;
the processing unit 402 is specifically configured to determine, when the framework template is analyzed to obtain an IF determination identifier, an IF determination result corresponding to the IF determination identifier from the configuration item parameter;
and determining whether to generate a functional module code corresponding to the IF judgment identifier in the skeleton template in the skeleton code according to the IF judgment result.
Optionally, the configuration item parameters include loop variables and corresponding loop variable values;
the processing unit 402 is specifically configured to determine a loop variable value corresponding to the loop variable from the configuration item parameters when the framework template is analyzed to obtain the loop variable;
and replacing the loop variable in the skeleton template with a loop variable value corresponding to the loop variable to generate a loop statement in the skeleton code.
Optionally, the configuration item parameter includes a macro replacement filename, where the macro replacement filename is used to replace a filename in the skeleton template that needs macro replacement.
Optionally, the configuration item parameter includes a file name execution permission parameter, where the file name execution permission parameter is used to determine an execution permission of a file name in the skeleton template.
Optionally, the skeleton template and the configuration item parameters are both stored in the form of files; or,
the skeleton template and the configuration item parameters are both stored in a database.
According to the skeleton code generator, an obtaining unit is used for obtaining a skeleton template and configuration item parameters configured on the basis of the skeleton template, wherein the skeleton template is a skeleton code template corresponding to a specified development mode, and the configuration item parameters are parameters configured for the skeleton template on the basis of development service logic of a project; the processing unit is used for analyzing the skeleton template and carrying out corresponding operation on the corresponding codes in the skeleton template based on the configuration item parameters to obtain the skeleton codes of the project, so that project developers can generate the skeleton codes through simpler parameter configuration operation, the time for the project developers to compile the skeleton codes is greatly saved, and the project development efficiency is effectively improved.
Fig. 5 is a schematic structural diagram of a skeleton code generator according to an embodiment of the present application. Skeleton code generator 500 may include: a channel interface 501 and a processor 502, optionally including a memory 503.
The channel interface 501, processor 502 and memory 503 may be interconnected by a bus 504 system. The bus 504 may be an ISA (Industry Standard Architecture) bus, a PCI (peripheral component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 5, but this does not indicate only one bus or one type of bus.
Optionally, a memory 503 is included for storing programs. In particular, the program may include program code comprising computer operating instructions. Memory 503 may include both read-only memory and random-access memory, and provides instructions and data to processor 502. The Memory 503 may include a Random-Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least 1 disk Memory.
The processor 502 is configured to execute the following operations, optionally, execute the program stored in the memory 503, and specifically, execute the following operations:
acquiring a skeleton template and configuration item parameters configured on the basis of the skeleton template, wherein the skeleton template is a skeleton code template corresponding to a specified development mode, and the configuration item parameters are parameters configured for the skeleton template on the basis of development service logic of a project;
analyzing the skeleton template, and carrying out corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters to obtain a skeleton code of the project.
The method performed by the skeletal code generator or manager (Master) node as disclosed in the embodiments of fig. 1 and fig. 3-4 of the present application may be implemented in the processor 502 or implemented by the processor 502. The processor 502 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 502. The Processor 502 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 503, and the processor 502 reads the information in the memory 503 and completes the steps of the above method in combination with the hardware thereof.
The skeleton code generator 500 may also execute the method in fig. 1, and implement the functions of the manager node or the data processing apparatus in the embodiments shown in fig. 3 and fig. 4, which are not described herein again in this embodiment of the present application.
Example 3
The embodiments of the present application also provide a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, enable the portable electronic device to perform the method of embodiment one.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Language Description Language), traffic, pl (core unified Programming Language), HDCal, JHDL (Java Hardware Description Language), langue, Lola, HDL, laspam, hardsradware (Hardware Description Language), vhjhd (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (15)
1. A method for generating a skeleton code, comprising:
acquiring a skeleton template and configuration item parameters configured on the basis of the skeleton template, wherein the skeleton template is a skeleton code template corresponding to a specified development mode, and the configuration item parameters are parameters configured for the skeleton template on the basis of development service logic of a project;
analyzing the skeleton template, and carrying out corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters to obtain a skeleton code of the project.
2. The method of claim 1, wherein the configuration item parameters include macro replacement variables and corresponding macro replacement variable values;
performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters, specifically including:
when the skeleton template is analyzed to obtain macro replacement variables, determining macro replacement variable values corresponding to the macro replacement variables from the configuration item parameters;
and replacing the macro replacement variable in the framework template with a macro replacement variable value corresponding to the macro replacement variable.
3. The method of claim 1, wherein the configuration item parameter comprises an IF decision statement, wherein the IF decision statement comprises an IF decision flag and an IF decision result;
performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters, specifically including:
when the framework template is analyzed to obtain an IF judgment identifier, determining an IF judgment result corresponding to the IF judgment identifier from the configuration item parameters;
and determining whether to generate a functional module code corresponding to the IF judgment identifier in the skeleton template in the skeleton code according to the IF judgment result.
4. The method of claim 1, wherein the configuration item parameters include loop variables and corresponding loop variable values;
performing corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters, specifically including:
when the framework template is analyzed to obtain a cycle variable, determining a cycle variable value corresponding to the cycle variable from the configuration item parameters;
and replacing the loop variable in the skeleton template with a loop variable value corresponding to the loop variable to generate a loop statement in the skeleton code.
5. The method of claim 1, wherein the configuration item parameters include a macro replacement filename, wherein the macro replacement filename is used to replace filenames in the skeleton template that require macro replacement.
6. The method of claim 1, wherein the configuration item parameters include a file name execution permission parameter, wherein the file name execution permission parameter is used to determine execution permission for a file name in the skeletal template.
7. The method of any of claims 1-6, wherein the skeleton template and the configuration item parameters are both stored in the form of files; or,
the skeleton template and the configuration item parameters are both stored in a database.
8. A skeleton code generator, comprising: an acquisition unit and a processing unit, wherein:
the framework template configuration method comprises an acquisition unit, a configuration item parameter and a configuration item parameter, wherein the acquisition unit is used for acquiring a framework template and the configuration item parameter configured on the basis of the framework template, the framework template is a framework code template corresponding to a specified development mode, and the configuration item parameter is a parameter configured for the framework template on the basis of the development service logic of a project;
and the processing unit is used for analyzing the skeleton template and carrying out corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters to obtain the skeleton code of the project.
9. The skeletal code generator of claim 8, wherein the configuration item parameters comprise macro replacement variables and corresponding macro replacement variable values;
the processing unit is specifically configured to determine, when the skeleton template is analyzed to obtain a macro replacement variable, a macro replacement variable value corresponding to the macro replacement variable from the configuration item parameters; and replacing the macro replacement variable in the framework template with a macro replacement variable value corresponding to the macro replacement variable.
10. The skeleton code generator of claim 8, wherein the configuration item parameters comprise an IF decision statement, wherein the IF decision statement comprises an IF decision flag and an IF decision result;
the processing unit is specifically configured to determine, when the framework template is analyzed to obtain an IF determination identifier, an IF determination result corresponding to the IF determination identifier from the configuration item parameter; and determining whether to generate a functional module code corresponding to the IF judgment identifier in the skeleton template in the skeleton code according to the IF judgment result.
11. The skeletal code generator of claim 8, wherein the configuration item parameters comprise loop variables and corresponding loop variable values;
the processing unit is specifically configured to determine a loop variable value corresponding to the loop variable from the configuration item parameters when the framework template is analyzed to obtain the loop variable; and replacing the loop variable in the skeleton template with a loop variable value corresponding to the loop variable to generate a loop statement in the skeleton code.
12. The skeletal code generator of claim 8, wherein the configuration item parameters comprise a macro replacement filename, wherein the macro replacement filename is used to replace filenames in the skeletal template that require macro replacement.
13. The skeletal code generator of claim 8, wherein the configuration item parameters comprise a file name execution permission parameter, wherein the file name execution permission parameter is used to determine execution permissions for file names in the skeletal template.
14. A skeletal code generator as claimed in any one of claims 8 to 13, wherein the skeleton template and the configuration item parameters are both stored in the form of files; or,
the skeleton template and the configuration item parameters are both stored in a database.
15. A skeleton code generator, comprising: a memory and a processor, wherein:
a memory for storing a program;
the processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
acquiring a skeleton template and configuration item parameters configured on the basis of the skeleton template, wherein the skeleton template is a skeleton code template corresponding to a specified development mode, and the configuration item parameters are parameters configured for the skeleton template on the basis of development service logic of a project;
analyzing the skeleton template, and carrying out corresponding operation on a corresponding code in the skeleton template based on the configuration item parameters to obtain a skeleton code of the project.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710159527.2A CN106874019A (en) | 2017-03-17 | 2017-03-17 | The generation method and skeletal code maker of a kind of skeletal code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710159527.2A CN106874019A (en) | 2017-03-17 | 2017-03-17 | The generation method and skeletal code maker of a kind of skeletal code |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106874019A true CN106874019A (en) | 2017-06-20 |
Family
ID=59171484
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710159527.2A Pending CN106874019A (en) | 2017-03-17 | 2017-03-17 | The generation method and skeletal code maker of a kind of skeletal code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106874019A (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108279882A (en) * | 2018-02-12 | 2018-07-13 | 百度在线网络技术(北京)有限公司 | Skeleton generating method, device, equipment and computer-readable medium |
CN109101231A (en) * | 2018-08-07 | 2018-12-28 | 百度在线网络技术(北京)有限公司 | Scripted code generation method, device, computer equipment and storage medium |
CN109343835A (en) * | 2018-08-28 | 2019-02-15 | 苏州浪潮智能软件有限公司 | A kind of rapid build business scaffold code instrumentation based on template |
CN109542420A (en) * | 2018-10-15 | 2019-03-29 | 张海光 | A kind of Code Edit method based on label |
CN110096263A (en) * | 2019-04-28 | 2019-08-06 | 贝壳技术有限公司 | Web front end code automatic generation method and device |
CN110969003A (en) * | 2018-09-29 | 2020-04-07 | 北京国双科技有限公司 | Text content generation method and device |
CN110968307A (en) * | 2018-09-29 | 2020-04-07 | 北京数聚鑫云信息技术有限公司 | Micro-service construction method and device based on intelligent generation of basic codes |
CN111273942A (en) * | 2018-12-04 | 2020-06-12 | 武汉斗鱼网络科技有限公司 | Code generation method, storage medium, electronic device and system |
CN111782207A (en) * | 2020-06-23 | 2020-10-16 | 北京青云科技股份有限公司 | Method, device and equipment for generating task stream code and storage medium |
CN112835564A (en) * | 2021-01-27 | 2021-05-25 | 北京海博思创科技股份有限公司 | Code generation method and device |
CN113312084A (en) * | 2021-05-26 | 2021-08-27 | 合肥移瑞通信技术有限公司 | AT framework code automatic generation method and device, electronic equipment and storage medium |
CN114385175A (en) * | 2020-10-20 | 2022-04-22 | 武汉斗鱼鱼乐网络科技有限公司 | Code generation method and device, electronic equipment and storage medium |
CN114610410A (en) * | 2022-03-16 | 2022-06-10 | 北京三快在线科技有限公司 | Parameter configuration method and device in simulation environment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102541829A (en) * | 2012-01-17 | 2012-07-04 | 中国工商银行股份有限公司 | Multiuser concurrent electronic document generation device and method |
CN105653669A (en) * | 2015-12-29 | 2016-06-08 | 网易(杭州)网络有限公司 | HTML (Hypertext Marked Language) generating method and device |
-
2017
- 2017-03-17 CN CN201710159527.2A patent/CN106874019A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102541829A (en) * | 2012-01-17 | 2012-07-04 | 中国工商银行股份有限公司 | Multiuser concurrent electronic document generation device and method |
CN105653669A (en) * | 2015-12-29 | 2016-06-08 | 网易(杭州)网络有限公司 | HTML (Hypertext Marked Language) generating method and device |
Non-Patent Citations (1)
Title |
---|
王学慧等: "联邦成员框架代码的自动生成技术研究", 《计算机仿真》 * |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108279882A (en) * | 2018-02-12 | 2018-07-13 | 百度在线网络技术(北京)有限公司 | Skeleton generating method, device, equipment and computer-readable medium |
CN108279882B (en) * | 2018-02-12 | 2021-07-27 | 百度在线网络技术(北京)有限公司 | Framework generation method, device, equipment and computer readable medium |
CN109101231A (en) * | 2018-08-07 | 2018-12-28 | 百度在线网络技术(北京)有限公司 | Scripted code generation method, device, computer equipment and storage medium |
CN109343835A (en) * | 2018-08-28 | 2019-02-15 | 苏州浪潮智能软件有限公司 | A kind of rapid build business scaffold code instrumentation based on template |
CN110968307A (en) * | 2018-09-29 | 2020-04-07 | 北京数聚鑫云信息技术有限公司 | Micro-service construction method and device based on intelligent generation of basic codes |
CN110969003A (en) * | 2018-09-29 | 2020-04-07 | 北京国双科技有限公司 | Text content generation method and device |
CN109542420A (en) * | 2018-10-15 | 2019-03-29 | 张海光 | A kind of Code Edit method based on label |
CN111273942A (en) * | 2018-12-04 | 2020-06-12 | 武汉斗鱼网络科技有限公司 | Code generation method, storage medium, electronic device and system |
CN110096263A (en) * | 2019-04-28 | 2019-08-06 | 贝壳技术有限公司 | Web front end code automatic generation method and device |
CN111782207A (en) * | 2020-06-23 | 2020-10-16 | 北京青云科技股份有限公司 | Method, device and equipment for generating task stream code and storage medium |
CN114385175A (en) * | 2020-10-20 | 2022-04-22 | 武汉斗鱼鱼乐网络科技有限公司 | Code generation method and device, electronic equipment and storage medium |
CN112835564A (en) * | 2021-01-27 | 2021-05-25 | 北京海博思创科技股份有限公司 | Code generation method and device |
CN113312084A (en) * | 2021-05-26 | 2021-08-27 | 合肥移瑞通信技术有限公司 | AT framework code automatic generation method and device, electronic equipment and storage medium |
CN114610410A (en) * | 2022-03-16 | 2022-06-10 | 北京三快在线科技有限公司 | Parameter configuration method and device in simulation environment |
CN114610410B (en) * | 2022-03-16 | 2024-05-24 | 北京三快在线科技有限公司 | Parameter configuration method and device in simulation environment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106874019A (en) | The generation method and skeletal code maker of a kind of skeletal code | |
CN107450972B (en) | Scheduling method and device and electronic equipment | |
CN109597661B (en) | Service function configuration method and device | |
CN107368292B (en) | Resource compiling method and device | |
CN110532020A (en) | A kind of data processing method of micro services layout, apparatus and system | |
CN107506181A (en) | Business processing, data processing method, device and electronic equipment | |
CN106293669B (en) | Webpage component generation method and device | |
CN107391101B (en) | Information processing method and device | |
CN110580153B (en) | Application program development method and device | |
CN109104327B (en) | Service log generation method, device and equipment | |
CN107562777B (en) | Data processing method and apparatus thereof | |
CN109241026B (en) | Data management method, device and system | |
CN109947643B (en) | A/B test-based experimental scheme configuration method, device and equipment | |
CN107038058B (en) | Code processing method and device | |
CN112597013A (en) | Online development and debugging method and device | |
US8584080B2 (en) | Modeling and generating computer software product line variants | |
WO2024041301A1 (en) | Method and apparatus for generating unified abstract syntax tree, and program analysis method and apparatus | |
CN114548744A (en) | Business risk management method, device and equipment | |
CN111767217A (en) | JS unit test case generation method and device | |
CN114547024A (en) | SQL statement risk detection method, device, equipment and medium | |
CN107391529B (en) | Method and device for realizing Object Relation Mapping (ORM) | |
CN106681781B (en) | Method and system for realizing real-time computing service | |
CN109284222B (en) | Software unit, project testing method, device and equipment in data processing system | |
CN109582300A (en) | Code analysis on altered project method, device and equipment based on path | |
CN107391099B (en) | Resource preprocessing method and device |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170620 |