CN106250134A - The code automatic generation method of unicity language - Google Patents
The code automatic generation method of unicity language Download PDFInfo
- Publication number
- CN106250134A CN106250134A CN201610601435.0A CN201610601435A CN106250134A CN 106250134 A CN106250134 A CN 106250134A CN 201610601435 A CN201610601435 A CN 201610601435A CN 106250134 A CN106250134 A CN 106250134A
- Authority
- CN
- China
- Prior art keywords
- code
- interface
- analysis method
- language
- nodal analysis
- 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.)
- Granted
Links
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/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
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 present invention relates to the code automatic generation method of unicity language, including: A. generates backstage code: A1. sets up nodal analysis method;A2. associate each nodal analysis method and set up tree shape model;A3. code is generated according to tree shape model;B. generate foreground code: B1. and define the interface application scene of described each nodal analysis method;B2. according to each nodal analysis method, the INTERFACE MODEL of associated is automatically generated;B3. according to step B1 and B2, the foreground code at least including GUI code is automatically generated.The present invention can generate the code of about 95% with automatization, considerably reduces development cost and the development time of software system, and it is 0 that development efficiency improves on decades of times, and code error rate theory.
Description
Technical field
The present invention relates to the code automatic generation method of computer program, be concretely the code for unicity language
Automatic generation method.
Background technology
The process of software system is typically first to be built data base by developer at present, can relate in the structure of data base
To multiple tables field, index, constraint etc., writing the generations such as data access, control program, interface program according to data base
Code.In this process, developer is needed to develop to the superiors from bottom one, if discovery data base's design under development
Unreasonable, or other any reason needs to increase Database field newly, revise and delete, and is required for re-starting the system of code
Make, so that in code generation process, need too much manually participate in and need substantial amounts of time and manpower to carry out weight
The code operation of renaturation.
Although technology also has some code building softwares, a kind of develop for the specific system of a certain kind,
But generally typically relating only to a local in program development process, special data base increases, deletes, changes, looks into code or script
Generate software.Another kind is the versatility code building software with cross-platform cross language, and " versatility " and " functional " is
Two mutually exclusive attributes, emphasize the code building software of " universal ", and function is inevitable the most powerful because different platforms or
Language, the most past above application layer, more toward details deeply, its difference is the biggest, and the application at such as UI interface is relative to data base
Layer and logical layer are more complex, the logic of its control routine generated also inevitable the most complicated, workload is bigger, unitized
Platform is difficult to the most complicated cross-platform function.Further, the structure of the project file of different platform or language is the most not
With, the code building software of versatility can not get up with concrete engineering structure binding, is therefore typically only capable to generate one little
Partial code, and need manually by the Code copying of generation to corresponding project file after generating code, hence it is evident that so
Reduce the efficiency of Code automatic build.
Therefore, the Code automatic build software of which kind of form, is unable to bottom from system is fully achieved the most at present
Complete code to interface automatically generates, and is required for too much artificial participation and substantial amounts of time and manpower carries out repeatability
Written in code works.
Summary of the invention
The invention provides the code automatic generation method of a kind of unicity language, can automatically generate for a certain language
All codes from bottom to interface, to be greatly reduced manual labor amount and development time.
The code automatic generation method of unicity language of the present invention, step includes:
A. generation backstage code:
A1. nodal analysis method is set up: according to interface input content, define the field that each nodal analysis method comprises;
A2. tree shape model is set up: according to the logical relation of data stream, define the horizontal and vertical pass of each nodal analysis method
Connection, forms at least one tree shape model being made up of nodal analysis method.Described laterally association refers to the difference without membership relation
Association between nodal analysis method, longitudinally association refers to the association between father node-child node;
A3. code is generated: according to described tree shape model, according to the syntax and semantics automatically generated data storehouse of program language
Table and the code corresponding with described database table, described code is also corresponding with described nodal analysis method, such as in Java system,
Each nodal analysis method correspondence generates a Class class, and the association between each code is consistent with described tree shape model;
B. generation foreground code:
B1. according to interface input content, the interface application scene of described each nodal analysis method, described interface application field are defined
Scape, in addition to the data of definition nodal analysis method show on interface in which way, has also defined when display these data
The mode of these data manipulations such as the mutual relation between control logic and other data.Such as: " logistics waybill " is a father
Nodal analysis method, " goods consigned " is the child node model of this " logistics waybill ".When the applied field defining this child node model
When scape is for " embed list-can edit ", then it is embedded for indicating the data of " goods consigned " display mode on interface
List View, be embedded into inside its editing view of father node " logistics waybill ".And the data to " goods consigned "
The control logic of " can edit " is also had: can be pressed by " increasing newly " inside the editing view of " logistics waybill " on interface
Button is increased newly the data of goods consigned, is deleted the data of goods consigned by " deletion " button, by the Edit button editor's logistics
The data of goods.Meanwhile, this nodal analysis method display mode on interface and control logic also are able to embody " logistics delivery
Single " and the filiation of " goods consigned " the two back end, present 1:N relation;
B2. according to each nodal analysis method, automatically generate the INTERFACE MODEL of associated, described INTERFACE MODEL at least includes with
The field that data model is corresponding.
B3. according to step B1 and B2, automatically generate according to the syntax and semantics of program language and at least include GUI code
Foreground code, such as html script, JSP script etc..
Described all kinds of " models " refer to data model, be have expressed by data model and need to show which data.
Data model is for being described volume of data feature, is the data structure that defines for depositing data of user, number
The parts such as data field, data manipulation, data constraint are normally comprised according to model.Defined in software system by data model
Each node, and these nodes are formed one or more tree structures according to mutual relatedness, it is possible to complete
Description whole system.
In the data model of node type, contain corresponding field etc., input these fields of definition by human interface
And nodal analysis method, and all of nodal analysis method is formed according to the logical relation of application the mould of one or more tree-like relations
Type, the logical relation representing whole system that just can be complete by each tree shape model.Last according to tree shape model and phase
The program language grammer answered, semantic generate corresponding with nodal analysis method and the code of tree shape model relationship consistency.Due to node mould
Type is the embodiment of each function, it is therefore desirable to by arranging the application scenarios of each nodal analysis method, such as form and showing, text shows
Show, tree-like displaying, editing view are shown, and can have which operation etc. to node data, represent each nodal analysis method is
How to apply.Generating INTERFACE MODEL by nodal analysis method, INTERFACE MODEL, for generating interface, is by described nodal analysis method
Application scenarios realize effect, finally generated GUI code by INTERFACE MODEL, the data of nodal analysis method shown.Backstage
Code, when obtaining data, is horizontal/longitudinal Relation acquisition data according to nodal analysis method each in tree shape model, the most tree-like mould
Type is the whole core automatically generated.
Owing to the code automatic generation method of the present invention is for unicity language, therefore can be fully according to a kind of language
The syntax and semantics of speech, with the Code automatic build from bottom to interface that described tree shape model is complete, except at definition joint
Outside the field of point model, relation and application scenarios need to be manually entered, the generation process of code need not artificial participation substantially
Getting final product the development of completion system, high degree reduces hand labor intensity, compares traditional development scheme and improves number
The development efficiency of ten times.
Although the INTERFACE MODEL of associated can be automatically generated according to each nodal analysis method, but generally saves in B2 step
Point model, for the needs extended, redundancy can define some fields, and these fields INTERFACE MODEL under normal circumstances is also not required to
Want, therefore generating after INTERFACE MODEL, the field in manual amendment's INTERFACE MODEL can be needed according to interface display, such as, delete
Operate except redundant field etc..
Further, according to frameworks such as the framework of current regular software system, such as MVC, should from data bottom to interface
Have three layers altogether or more functional layer division between layer, therefore the most corresponding with database table described in step A3 code,
Including data base configuration file and the program code calling data base, such as hibernate hbm.xml configuration mapped file and
The DAO code etc. of Java.
According to the segmentation of system architecture, described in call the program code of data base and can also include directly invoking data base's
Code and logical code.The DAO code of such as Java belongs to and directly invokes database code, and Manager code then belongs to logic
Code, Manager is that DAO code is called in the input receiving higher.
In order to make interface have aesthetic property and part functionalities, the foreground code that step B3 generates also includes interface script generation
Code, such as CSS file, Javascript file etc..These script files can be according to the setting field in nodal analysis method, pattern
Automatically generate etc. parameter.
Further, the foreground code that step B3 generates also includes to interface and the backstage code associated with this interface two-way
The control routine of transmission data, such as the Controller category code in Java system.This category code is linkage interface and backstage
Program, it is possible to reception interface inputs and call the code that backstage is corresponding.
Optionally, the test case that can call backstage code can also be included in the foreground code that step B3 generates.Root
According to function and the backstage code of INTERFACE MODEL, automatically generate corresponding test case, it is possible to more convenient system is surveyed
Examination.
Owing to constituting tree structure incidence relation between each node, in order to make data information transfer convenient, step
The code that A3 generates can be according to the incidence relation of tree shape model interior joint model, bi-directional data transmission between each nodal analysis method.
The code (method in such as Java system) that the most each nodal analysis method generates can obtain the institute of father node by modes such as successions
There are field or method information, the information of its all child nodes can also be obtained simultaneously by modes such as traversals, be consequently formed one
Huge data network, any one node all can obtain the information of other node easily.
On this basis, make INTERFACE MODEL and nodal analysis method the most corresponding for convenient, it is simple to code is given birth to automatically
Become and should be readily appreciated that maintenance, preferably the title of field and type and word in corresponding nodal analysis method in default interface model
The title of section is identical with type, and nodal analysis method directly generates the field of INTERFACE MODEL according to the field defined.It is of course also possible to root
Manual amendment and corresponding configuration is carried out according to practical situation.
Learnt by test, the method for the present invention can high degree improve software system development efficiency, can be automatic
Metaplasia becomes the code of about 95%, saves the development time of nearly 90%.Developer need not from the beginning exploitation code, only need to be to life
The code become does a small amount of debugging and can complete development.Also considerably reduce the development cost of software system simultaneously, one
Individual developer can complete the work that one team of tradition completes, such as, with traditional approach, whole backstage is developed needs
The time of Hua Yizhou, had only to 2 to 3 hours by the present invention, improve the efficiency of decades of times.Owing to code is automatically generated
, the most all codes have extremely low error rate, and error probability can be reduced to 0 in theory.
Below in conjunction with the detailed description of the invention of embodiment, the foregoing of the present invention is described in further detail again.
But this should not being interpreted as, the scope of the above-mentioned theme of the present invention is only limitted to Examples below.Thinking without departing from the above-mentioned technology of the present invention
In the case of thinking, the various replacements made according to ordinary skill knowledge and customary means or change, all should be included in this
In bright scope.
Accompanying drawing explanation
Fig. 1 is the flow chart of the code automatic generation method of unicity language of the present invention.
Detailed description of the invention
Embodiment 1:
As it is shown in figure 1, the code automatic generation method of unicity language of the present invention, as a example by Java language, step has:
A. generation backstage code:
A1. nodal analysis method is set up: each nodal analysis method is corresponding with a Class class.According to interface input content, definition
The field that each nodal analysis method comprises, including field name, field type etc.;
A2. tree shape model is set up: according to the logical relation of data stream, define the horizontal and vertical pass of each nodal analysis method
Connection, forms at least one tree shape model being made up of nodal analysis method.Described laterally association refers to the difference without membership relation
Association between nodal analysis method, longitudinally association refers to the association between father node-child node;And each nodal analysis method is set all
Can be according to the incidence relation of tree shape model interior joint model, bi-directional data transmission between each nodal analysis method;
A3. code is generated: according to described tree shape model, according to the syntax and semantics automatically generated data storehouse of Java language
Table and the code corresponding with described database table, described code is also corresponding with described nodal analysis method, and each nodal analysis method is corresponding
Generate a Class class, and the association between each code is consistent with described tree shape model.According to current regular software system
Framework, haves three layers from data bottom to interface application layer altogether or more functional layer divides, therefore described and database table pair
The code answered, includes the hbm.xml such as hibernate and configures the configuration files such as mapping, and call the DAO code of data base
With the Manager code calling DAO code.This step all can be according to tree-like mould according to all Class classes that nodal analysis method generates
The incidence relation of type interior joint model, obtains all fields or the method information of father node by modes such as successions, also may be used simultaneously
To be obtained the information of its all child nodes by modes such as traversals.
B. generation foreground code:
B1. according to interface input content, defining the interface application scene of described each nodal analysis method, such as form shows, literary composition
This display, tree-like displaying, editing view displaying etc., there is shown how each nodal analysis method is applied on interface.Interface application
Scene defines the data of nodal analysis method and shows in which way on interface, has also defined the control to these data when display
Logic processed and and other data between the mode of these data manipulations such as mutual relation.Such as: " logistics waybill " is one
Father node model, " goods consigned " is the child node model of this " logistics waybill ".When the application defining this child node model
When scene is for " embed list-can edit ", then indicate the data of " goods consigned " display mode on interface for embedding
The List View of formula, is embedded into inside its editing view of father node " logistics waybill ".And the number to " goods consigned "
Control logic according to also having " can edit " on interface: " increasing newly " can be passed through inside the editing view of " logistics waybill "
Button is increased newly the data of goods consigned, is deleted the data of goods consigned by " deletion " button, by the Edit button compilation
The data of stream goods.Meanwhile, this nodal analysis method display mode on interface and control logic also are able to embody " logistics delivery
Single " and the filiation of " goods consigned " the two back end, present 1:N relation.
B2. according to each nodal analysis method, automatically generate the INTERFACE MODEL of associated, described INTERFACE MODEL at least includes with
The title of field and type and field in corresponding nodal analysis method in the field that data model is corresponding, and default interface model
Title is identical with type, and nodal analysis method directly generates the field of INTERFACE MODEL according to the field of definition.Can also be according to actual feelings
Condition carries out manual amendment and corresponding configuration.Then according to the artificial redundancy word deleted in INTERFACE MODEL of needs of interface display
Section.
B3. according to step B1 and B2, automatically generate according to the syntax and semantics of program language and at least include GUI code
Foreground code, such as html script, JSP script etc..Meanwhile, always according to parameters such as the setting field in nodal analysis method, patterns certainly
The dynamic interface scripted codes such as CSS, Javascript that generate, and to interface and the backstage code transmitted in both directions that associates with this interface
The Controller class control routine of data.
Embodiment 2:
On the basis of embodiment 1, can also include calling backstage code in the foreground code that step B3 generates
Test case, including by various functionally or logically to the increasing of data base, delete, change, to look into operation the most correct etc..According to interface mould
The function of type and backstage code, automatically generate corresponding test case, it is possible to more convenient tests system.
Claims (9)
1. the code automatic generation method of unicity language, its feature includes:
A. generation backstage code:
A1. nodal analysis method is set up: according to interface input content, define the field that each nodal analysis method comprises;
A2. tree shape model is set up: according to the logical relation of data stream, define the horizontal and vertical association of each nodal analysis method, shape
Become at least one tree shape model being made up of nodal analysis method;
A3. generate code: according to described tree shape model, according to program language syntax and semantics automatically generated data storehouse table and
The code corresponding with described database table, described code is also corresponding with described nodal analysis method, the association between each code and institute
State tree shape model consistent;
B. generation foreground code:
B1. according to interface input content, the interface application scene of described each nodal analysis method is defined;
B2. according to each nodal analysis method, automatically generate the INTERFACE MODEL of associated, described INTERFACE MODEL at least includes and data
The field that model is corresponding;
B3. according to step B1 and B2, the foreground at least including GUI code is automatically generated according to the syntax and semantics of program language
Code.
2. the code automatic generation method of unicity language as claimed in claim 1, is characterized by: step B2 is generating interface
After model, need the field in manual amendment's INTERFACE MODEL according to interface display.
3. the code automatic generation method of unicity language as claimed in claim 1, is characterized by: with number described in step A3
According to the code that storehouse table is corresponding, including data base configuration file and the program code calling data base.
4. the code automatic generation method of unicity language as claimed in claim 3, is characterized by: described in call data base's
Program code includes code and the logical code directly invoking data base.
5. the code automatic generation method of unicity language as claimed in claim 1, is characterized by: the foreground that step B3 generates
Code also includes interface scripted code.
6. the code automatic generation method of unicity language as claimed in claim 1, is characterized by: the foreground that step B3 generates
Code also includes to interface and the control routine of backstage code bi-directional transfer of data that associates with this interface.
7. the code automatic generation method of unicity language as claimed in claim 1, is characterized by: the foreground that step B3 generates
Code also includes the test case that can call backstage code.
8. the code automatic generation method of the unicity language as described in one of claim 1 to 7, is characterized by: step A3 is raw
The code become can be according to the incidence relation of tree shape model interior joint model, bi-directional data transmission between each nodal analysis method.
9. the code automatic generation method of the unicity language as described in one of claim 1 to 7, is characterized by: INTERFACE MODEL
The title of middle field is identical with title and the type of field in corresponding nodal analysis method with type.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610601435.0A CN106250134B (en) | 2016-07-28 | 2016-07-28 | The code automatic generation method of single language |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610601435.0A CN106250134B (en) | 2016-07-28 | 2016-07-28 | The code automatic generation method of single language |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106250134A true CN106250134A (en) | 2016-12-21 |
CN106250134B CN106250134B (en) | 2019-03-19 |
Family
ID=57603360
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610601435.0A Active CN106250134B (en) | 2016-07-28 | 2016-07-28 | The code automatic generation method of single language |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106250134B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107943470A (en) * | 2017-11-23 | 2018-04-20 | 四川长虹电器股份有限公司 | Cloud management platform code generates the System and method for recycling |
CN109086039A (en) * | 2018-08-02 | 2018-12-25 | 济南安软天健科技有限公司 | A kind of automatic write method of code |
CN109840072A (en) * | 2019-02-02 | 2019-06-04 | 北京字节跳动网络技术有限公司 | Information processing method and device |
CN112328340A (en) * | 2020-10-23 | 2021-02-05 | 前海飞算云创数据科技(深圳)有限公司 | Model process display method, device, electronic equipment and storage medium |
CN112882693A (en) * | 2021-01-19 | 2021-06-01 | 深圳市斯尔顿科技有限公司 | Data management system design method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101714078A (en) * | 2008-10-06 | 2010-05-26 | 广东金宇恒科技有限公司 | Code generation method and device |
CN101727324A (en) * | 2009-12-17 | 2010-06-09 | 中国电力科学研究院 | Code generation method and device |
CN104049957A (en) * | 2013-03-13 | 2014-09-17 | 成都泰聚泰科技有限公司 | Rapid modeling frame of general business model based on star structure |
-
2016
- 2016-07-28 CN CN201610601435.0A patent/CN106250134B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101714078A (en) * | 2008-10-06 | 2010-05-26 | 广东金宇恒科技有限公司 | Code generation method and device |
CN101727324A (en) * | 2009-12-17 | 2010-06-09 | 中国电力科学研究院 | Code generation method and device |
CN104049957A (en) * | 2013-03-13 | 2014-09-17 | 成都泰聚泰科技有限公司 | Rapid modeling frame of general business model based on star structure |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107943470A (en) * | 2017-11-23 | 2018-04-20 | 四川长虹电器股份有限公司 | Cloud management platform code generates the System and method for recycling |
CN107943470B (en) * | 2017-11-23 | 2020-10-23 | 四川长虹电器股份有限公司 | System and method for generating and recovering cloud management platform codes |
CN109086039A (en) * | 2018-08-02 | 2018-12-25 | 济南安软天健科技有限公司 | A kind of automatic write method of code |
CN109840072A (en) * | 2019-02-02 | 2019-06-04 | 北京字节跳动网络技术有限公司 | Information processing method and device |
CN109840072B (en) * | 2019-02-02 | 2022-05-06 | 北京字节跳动网络技术有限公司 | Information processing method and device |
CN112328340A (en) * | 2020-10-23 | 2021-02-05 | 前海飞算云创数据科技(深圳)有限公司 | Model process display method, device, electronic equipment and storage medium |
CN112882693A (en) * | 2021-01-19 | 2021-06-01 | 深圳市斯尔顿科技有限公司 | Data management system design method |
Also Published As
Publication number | Publication date |
---|---|
CN106250134B (en) | 2019-03-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106250134B (en) | The code automatic generation method of single language | |
CN106528129B (en) | A kind of Web application interface generation system and method | |
CN102521120B (en) | Software automation test system and method | |
CN105677875B (en) | A kind of visual modeling platform based on the unified constraint of normal data element | |
JP5905182B2 (en) | Method and system for editing and reporting graphic programming language objects | |
CN107291450A (en) | A kind of quick code automatic generation method for programming friendly | |
CN104049957A (en) | Rapid modeling frame of general business model based on star structure | |
CN108469952A (en) | A kind of code generating method and kit of management game configuration | |
CN112199086A (en) | Automatic programming control system, method, device, electronic device and storage medium | |
CN108597014A (en) | A kind of editing system of the cross-platform rendering effect based on visual programming | |
CN105930344A (en) | Database application rapid development platform based on product development process | |
Handley et al. | Maintaining the consistency of sysml model exports to XML metadata interchange (XMI) | |
CN106951593B (en) | Method and device for generating configuration file of protection measurement and control device | |
CN103593188A (en) | System and method for managing what-you-see-is-what-you-get menus of instrument | |
US7203925B1 (en) | Graphical compiler | |
CN116627418B (en) | Multi-level form interface visual generation method and device based on recursion algorithm | |
JP2001325098A (en) | Method for preparing application program method for operating database, method for managing item object, method for controlling module operation and computer- readable recording medium recorded with program for realizing operation, management and control methods | |
CN103377076A (en) | Method and system for adjusting task execution plans during operation | |
JP7250009B2 (en) | How it is done by client-end programming tools | |
CN112100984A (en) | Data conversion method and system from EBOM to SBOM | |
CN113342325A (en) | Visual modeling method, system, electronic device and storage medium | |
CN114281797A (en) | Method for quickly creating basic level data aggregation warehouse based on agile low-code platform | |
CN104731700B (en) | A kind of unit test system and method for supporting table driving local data | |
Reis et al. | XIS-Reverse: a model-driven reverse engineering approach for legacy information systems | |
CN103714035B (en) | Multilayer software bus structure for integrated environment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |