CN103176803A - Code serialization method - Google Patents

Code serialization method Download PDF

Info

Publication number
CN103176803A
CN103176803A CN2013101346483A CN201310134648A CN103176803A CN 103176803 A CN103176803 A CN 103176803A CN 2013101346483 A CN2013101346483 A CN 2013101346483A CN 201310134648 A CN201310134648 A CN 201310134648A CN 103176803 A CN103176803 A CN 103176803A
Authority
CN
China
Prior art keywords
code
data
software
character string
serializing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2013101346483A
Other languages
Chinese (zh)
Inventor
江辅华
曾志良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CHENGDU 1STCLOUD DATA PROCESSING Co Ltd
Original Assignee
CHENGDU 1STCLOUD DATA PROCESSING Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CHENGDU 1STCLOUD DATA PROCESSING Co Ltd filed Critical CHENGDU 1STCLOUD DATA PROCESSING Co Ltd
Priority to CN2013101346483A priority Critical patent/CN103176803A/en
Publication of CN103176803A publication Critical patent/CN103176803A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a code serialization method and belongs to the field of software development. The computer software consists of codes and data, and the functions of the software are shown by the codes and data. The code serialization method comprises the following steps: 1, assigning the codes to a character string code so as to realize code serialization, compiling the serialized codes into machine codes which can be identified by a virtual machine, thus obtaining a character string P-Code; and 2, combining the character string P-Code and host software. The code comprises an applied logic, the data can be stored and transmitted in the software operation, and the codes are relatively stable in the operation process and cannot be changed. The increase and change of the functions of the software can be generally realized by data only. After the codes are serialized into data, the data can be transmitted and changed and is reduced into codes, and the flexibility of the software is improved; and moreover, the method is suitable for business software development.

Description

A kind of method of code sequence
Technical field
The present invention relates to technical field of computer programs, a kind of method of code sequence is provided.
Background technology
the increasing micro-chip processor of using in present various product, go to control the behavior of product with software, improving reliability and the expanded function of product. the characteristics of this series products are, software embodies in the mode of firmware, in case install, not by producer and and the specialized maintenance station just basically can not upgrade to software. in order to solve the problem of having found, such as automobile industry, solve by recalling a large amount of same model products. waste time and energy. also allow potential problem solve and can not get timely processing. such as the brake problem of some automobile, be exactly the problem of software control algorithm or logic. repair software, will inevitably cause solidification software again. other desktop software system also exists similar problem, such as the software of a production control flow process, change due to user's flow process, causing the variation of software. the variation of any software is upgraded, all need again to issue, if be from developing software, not affecting present production if need to upgrade each computer software. difficulty and cost are all larger. and be the business software of buying, be difficult in time obtain upgrading so later software. those problems above-mentioned, all in software life-cycle in fact, variation due to software requirement, cause the variation of code, thereby cause issue again and the installation of software.
Here introduce our ratio juris with a simple example. take the charging unit of automobile as example, the below is a software model of having simplified fully:
Charging unit object (Charger)
{
Attribute:
Current battery tension (V)
Voltage minimum (Min)
Voltage max (Max)
Detect voltage time interval (Interval)
Method:
Detect current voltage (Detect)
Charging (Charge)
{
If current voltage<voltage minimum is charging just
If current voltage〉voltage max just stop the charging
}
}
above-mentioned object is exactly data (Data) and code (composition), data embody with attribute, such as current voltage, code is exactly that method with applied logic embodies, such as charging method. code section can not change after the software issue and before the issue of next version, data are to store, change, be delivered to the other system of automobile. cause software change except revising existing system, also have other factors also to cause the upgrading of software to change, for example: system need to increase new function, revise and strengthen existing function, delete unwanted function, above-mentioned behavior also can cause the variation of data structure, take relational database as example, cause increasing and decreasing the row of tables of data, type and the width change of row.
Summary of the invention
The present invention be intended to provide a kind of by serializing with code data, and the later code of datumization in essence or data, so long as data are just revised very easily, update routine is by revising getting final product of the later data stream of serializing, facilitates like this method of code sequence of the modification of later stage program.
The present invention is to achieve these goals by the following technical solutions:
A kind of method of code sequence is characterized in that comprising the following steps:
Step 1, with the code value of paying to a character string code, code serializing; The later code of serializing, be compiled into the machine code of virtual function identification, obtain character string P-Code;
Step 2, character string P-Code and host software are combined.
In such scheme, described character string code is stored in lane database, then reads from lane database, with the position of character string forms link (insertion) to original serializing.
In such scheme, adopt script.Execute (code, this) to carry out the unserializing action, the data character string code that serializing is later and current host software runtime environment this pass to script.Execute (code, this), the code after executing data.
In such scheme, host software combines and can adopt following 2 kinds of methods:
The first: P-Code, be converted to the machine code of host software, such as Java language, so just be converted to bytecode;
The second: be dynamically embedded into operation.
Code sequenceization is common a kind of sequencing method to the character crossfire, can also serializing arrive binary data, XML etc., for the ease of the simplification problem, with describe the problem, the later data layout of seriation is directly with the form of code source program, this is exactly the character string code that in literary composition, example is showed, because use source program format, using serializing is exactly a simple job, there is no in article and carry. key problem in technology is exactly how the later character crossfire unserializing of serializing, allows it equally go operation with real code.
1, a definition character string code (this is exactly the later data of serializing in fact), this character string is to be stored in lane database usually, then reads from lane database, with the position of character string forms link (insertion) to original serializing;
2, adopt script.Execute (code, this) carry out the unserializing action, code (data that serializing is later) and this (current host software runtime environment) are passed to script.Execute (code, this), the code after executing data.
The advantage that adopts above technical scheme is exactly with code data by serializing, and the later code of datumization in essence or data, so long as data are just revised very easily, update routine facilitates the modification of later stage program like this by revising getting final product of the later data stream of serializing.
The present invention has following beneficial effect:
This method allows the code that has existed that the straightforward procedure of a serializing has been arranged, thereby improves the flexibility of software.By the modification to the later data of code sequenceization, increase and newly subtract function, thereby allow the consumer of data after code sequence, in the situation that do not reinstall/solidification software, update functions has been arranged. can be a large amount of economize on the use of funds and the time. wide market outlook are arranged.
Embodiment
A computer system has even up to a hundred microprocessors (perhaps computing machine) composition of dozens of usually, and these collaborative computers participate in finishing the work.What transmit between computing machine is all data (message, order, data) basically.After computing machine is received data, carry out corresponding predetermined action, but can't produce a new action (action outside predetermined action).System cooperating is completed a task according to certain flow process (workflow).Flow process is preset.In computer realm, exactly object (object) serializing (Serialization) is delivered to other computing machine and is reduced to object (Deserialization), carry out predetermined action (operation).The later data that obtain of serializing can also be stored except transmitting.The serializing of object is exactly the serializing to the software object attribute in essence.The form of common serializing data has 2 classes, and a class is privately owned binary format data, and also having a class is to use the XML form, or the mutation of XML, and widely used have JSON, such as the SOAP form that uses in Web Service.Take the charging object as example, the below is the data layout of XML:
<Charger>
<Voltage>10</Voltage>
<Max>14</Max>
<Min>7</Min>
<Interval>5</Interval>
</Charger>
The JSON form:
{"Charger":
{"Voltage": 10,
"Max": 14,
"Min": 7
"Interval": 5
}
}
So-called action is exactly to carry out some computer codes, the method in computer software namely, and generally we can not be to code sequence.Code is used for presentation logic knowledge.If code also can serializing, represent that so software has:
1, the transmission capacity of knowledge: if we can be delivered to some code sequences in other computing machine B from computer A, allow computing machine B carry out corresponding new action.
2, the self-learning capability of knowledge: in the situation that computing machine loses and other computing machine contacts, oneself has learning ability computing machine.Carry out and create the action that makes new advances.
Traditional way is used knowledge system, and in essence or data transmission and generation, these knowledge can produce new action, but these actions or preset, and it can not solve the problem of generation new element.
1, do intelligence system, such as knowledge represents (essence or traditional data) with rule
2, knowledge can also represent with model, such as the model of neural network (being a data structure)
The example of the code sequence of the above's charging object is:
{"Charger":
{"Voltage": 10,
"Max": 14,
"Min": 7
"Interval": 5
"Charge": if(voltage > Max) StopCharge(); if(Voltage<Min) StartCharge();
}
}
After code sequence turned to data, except the attribute as the knowledge representation of code own, as data attribute, the later code of serializing can be retrieved by image data like that, revised increase and decrease.How the serializing code has become key issue.
If designing and developing of brand-new software can be selected above-mentioned design so. for the software that has existed, the top design effort of taking a lot of work that seems.
The below is process and the grade of the example serializing that comes description code with C# language design Windows Form window.This simple Form shows a Label and a Button exactly.
After clicking Button, the displaying contents of Button is " OK ", the content of Label is shown as " and Good bye (n) "
After clicking Label, the displaying contents of Button is " Cancel (n) ", the content of Label is shown as " and Hello World ", wherein (n) clicks for the n time for integer representation. and following is the C# program of standard, can programing operation
1 class LabelButtonForm0 : Form
2 {
3 private System.Windows.Forms.Button button1;
4 private System.Windows.Forms.Label label1;
5 int count = 0;
6 public LabelButtonForm0()
7 {
8 button1 = new System.Windows.Forms.Button();
9 label1 = new System.Windows.Forms.Label();
10 button1.Location = new System.Drawing.Point(50, 140);
11 button1.Size = new System.Drawing.Size(120, 24);
12 button1.Text = "Cancel";
13 label1.Location = new System.Drawing.Point(50, 40);
14 label1.AutoSize = true;
15 label1.Size = new System.Drawing.Size(120, 24);
16 label1.Text = "Good Morning!";
17 Controls.Add(this.label1);
18 Controls.Add(this.button1);
19 button1.Click += delegate(object sender, EventArgs e)
20 {
21 ((Button)sender).Text="OK";
22 label1.Text = "Good bye "+ count++;
23 };
24 label1.Click += delegate(object sender, EventArgs e)
25 {
26 ((Label)sender).Text="Hello World";
27 button1.Text = "Cancel " + count++;
28 };
29 this.Show();
30 }
31 }
We demonstrate the Event triggered serializing Button and Label now, and button1.Click and label1.Click sequence turn to the information flow of string format, and the below is example:
1 class LabelButtonForm1 : Form
2 {
3 private System.Windows.Forms.Button button1;
4 private System.Windows.Forms.Label label1;
5 int count = 0;
6 Script script = new Script();
7 public LabelButtonForm1()
8 {
9 button1 = new System.Windows.Forms.Button();
10 label1 = new System.Windows.Forms.Label();
11 button1.Location = new System.Drawing.Point(50, 140);
12 button1.Size = new System.Drawing.Size(120, 24);
13 button1.Text = "Cancel";
14 label1.Location = new System.Drawing.Point(50, 40);
15 label1.AutoSize = true;
16 label1.Size = new System.Drawing.Size(120, 24);
17 label1.Text = "Good Morning!";
18 Controls.Add(this.label1);
Controls.Add(this.button1);
19 this.Text = "Event Handler";
20 string code=" code that // serializing is later
21 button1.Click += delegate(sender,e)
22 {
23 sender.Text='OK';
24 label1.Text = 'Good bye '+ count++;
25 };
26 label1.Click += delegate(sender,e)
27 {
28 sender.Text='Hello World';
29 button1.Text = 'Cancel ' + count++;
30 };
31 ";
32 script.Execute(code, this);
33 this.Show();
34 }
35 }
More top two programs, we can find, the later code section (20-32 section) of serializing is consistent with original code basically.Unique difference is used dynamic variable exactly. do not need to state types of variables.Serializing module (Script) can the Auto-Sensing type of variables.
We also can carry out serializing to the attribute statement of Button and Label. referring to the 15-21 section of code.
1 class LabelButtonForm2 : Form
2 {
3 private System.Windows.Forms.Button button1;
4 private System.Windows.Forms.Label label1;
5 int count = 0;
6 Script script;
7 public LabelButtonForm2()
8 {
9 button1 = new System.Windows.Forms.Button();
10 label1 = new System.Windows.Forms.Label();
11 Controls.Add(this.label1);
12 Controls.Add(this.button1);
13 script = new Script();
14 string code=" code that // serializing is later
15 button1.Location = new System.Drawing.Point(50, 140);
16 button1.Size = new System.Drawing.Size(120, 24);
17 button1.Text = 'Cancel';
18 label1.Location = new System.Drawing.Point(50, 40);
19 label1.AutoSize = true;
20 label1.Size = new System.Drawing.Size(120, 24);
21 label1.Text = 'Good Morning!';
22 button1.Click += delegate(sender,e)
23 {
24 sender.Text='OK';
25 label1.Text = 'Good bye '+ count++;
26 };
27 label1.Click += delegate(sender,e)
28 {
29 sender.Text='Hello World';
30 button1.Text = 'Cancel ' + count++;
31 };
32 ";
33 script.Execute(code, this);
34 this.Show();
35 }
36 }

Claims (4)

1. code sequence method is characterized in that comprising the following steps:
Step 1, with the code value of paying to a character string code, code serializing; The later code of serializing, be compiled into the machine code of virtual function identification, obtain character string P-Code;
Step 2, character string P-Code and host software are combined.
2. a kind of code sequence method according to claim 1, it is characterized in that: described character string code is stored in lane database, then reads from lane database, arrives the position of original serializing with character string forms link (insertions).
3. a kind of code sequence method according to claim 1, it is characterized in that: adopt script.Execute (code, this) carry out the unserializing action, the data character string code that serializing is later and current host software runtime environment this pass to script.Execute (code, this), the code after executing data.
4. a kind of code sequence method according to claim 1, it is characterized in that: host software combines and can adopt following 2 kinds of methods:
The first: P-Code, be converted to the machine code of host software, such as Java language, so just be converted to bytecode;
The second: be dynamically embedded into operation.
CN2013101346483A 2013-04-18 2013-04-18 Code serialization method Pending CN103176803A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2013101346483A CN103176803A (en) 2013-04-18 2013-04-18 Code serialization method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2013101346483A CN103176803A (en) 2013-04-18 2013-04-18 Code serialization method

Publications (1)

Publication Number Publication Date
CN103176803A true CN103176803A (en) 2013-06-26

Family

ID=48636708

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2013101346483A Pending CN103176803A (en) 2013-04-18 2013-04-18 Code serialization method

Country Status (1)

Country Link
CN (1) CN103176803A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111290777A (en) * 2020-01-23 2020-06-16 复旦大学 Evolution history slicing method oriented to software code unit and code measurement

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719902A (en) * 2009-12-04 2010-06-02 深圳创维数字技术股份有限公司 Remote procedure calling (PRC) method and system
CN102393857A (en) * 2011-11-01 2012-03-28 中兴通讯股份有限公司 Method and system for local call based on web page
CN102662984A (en) * 2012-03-14 2012-09-12 南京新与力文化传播有限公司 HTML(hypertext markup language)-based multi-platform message handling method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719902A (en) * 2009-12-04 2010-06-02 深圳创维数字技术股份有限公司 Remote procedure calling (PRC) method and system
CN102393857A (en) * 2011-11-01 2012-03-28 中兴通讯股份有限公司 Method and system for local call based on web page
CN102662984A (en) * 2012-03-14 2012-09-12 南京新与力文化传播有限公司 HTML(hypertext markup language)-based multi-platform message handling method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
王静: ""软件智能嵌入技术的研究及其安全应用"", 《中国优秀硕士学位论文全文数据库》, 15 November 2007 (2007-11-15) *
高静: ""JSON序列化机制与传输效率研究"", 《中国优秀硕士学位论文全文数据库》, 15 August 2011 (2011-08-15) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111290777A (en) * 2020-01-23 2020-06-16 复旦大学 Evolution history slicing method oriented to software code unit and code measurement

Similar Documents

Publication Publication Date Title
US8448132B2 (en) Systems and methods for modifying code generation templates
CN109614093B (en) Visual intelligent contract system and intelligent contract processing method
US10248386B2 (en) Generating a software complex using superordinate design input
Atkinson et al. Symbiotic general-purpose and domain-specific languages
Peissner et al. Requirements for the successful market adoption of adaptive user interfaces for accessibility
White et al. The generic eclipse modeling system
CN103176803A (en) Code serialization method
CN102662662A (en) Embedded graphics interface generation system and method
Palviainen et al. A semi-automatic end-user programming approach for smart space application development
Märtin et al. Patterns and models for automated user interface construction–in search of the missing links
US20100269089A1 (en) Method and system for generation of reusable design patterns
Masuda et al. Direction of digital it and enterprise architecture
Kumar et al. Cost Model for Reengineering an Object Oriented Software System
Wendler et al. Theoretical and practical implications of user interface patterns applied for the development of graphical user interfaces
Swan et al. Polytypic Genetic Programming
Saeki et al. Model metrics and metrics of model transformations
Rao et al. Fault tolerant web services composition as planning
Tomic et al. agriopenlink: Towards adaptive agricultural processes enabled by open interfaces, linked data and services
Pei et al. Researchment of metadata-driven based informatization strategy of parameter'life cycle management
Bresniker et al. What Gets You Hired Now Will Not Get You Hired Then
Bernaschina Tools, semantics and work-flows for web and mobile model driven development
Taleb et al. Transformation Rules in POMA Architecture.
Wang et al. Semantic-element-based Defining Approach for Model Transformation Rules
Fernandez-Llatas et al. Process choreography for human interaction computer-aided simulation
Hou Model-based approach for reporting system development

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20130626