[译]展望未来-Bots生成的源代码
By robot-v1.0
本文链接 https://www.kyfws.com/ai/a-look-into-the-future-source-code-generation-by-t-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 20 分钟阅读 - 9625 个词 阅读量 0展望未来-Bots生成的源代码(译文)
原文地址:https://www.codeproject.com/Articles/1156694/A-Look-into-the-Future-Source-Code-Generation-by-t
原文作者:Dmitriy Gakh
译文由本站 robot-v1.0 翻译
前言
The perspectives of creating bots that write programs with two simple examples.
创建具有两个简单示例的程序的机器人的观点.
- 下载Bot 1(FuncGenerator)-9 KB(Download Bot 1 (FuncGenerator) - 9 KB)
- 下载Bot 2(FuncGeneratorGenetic)-13 KB(Download Bot 2 (FuncGeneratorGenetic) - 13 KB) 请阅读(Please read) 使用代码(Using the Code) 在运行代码之前.(before running the code.)
介绍(Introduction)
已经开发了软件开发技术,以满足日益增长的需求以及硬件和方法论的能力.为了简化体力劳动,自动化在软件开发中的作用越来越重要.软件开发自动化的示例包括代码构建管理器,静态代码分析器,测试等系统.(Software development technologies have been evolved to fulfill growing demand and capabilities of hardware and methodologies. Role of automation in software development plays a more and more significant role in order to simplify manual labor. Examples of the software development automation include systems of code build managers, static code analyzers, tests, and so on.)
另一方面,在人工智能和机器人技术领域的研究显示出重大进展.被称为"机器人"的软件家族正在不断壮大.这些漫游器实现了预定义的逻辑,它们的功能实际上仅受硬件限制.可以将现代软件开发技术应用于构建可以执行软件开发任务的机器人.(On the other hand, researches in the field of artificial intelligence and robotics show significant progress. The family of software that are named “bots” is intensively growing. The bots implement predefined logic, and their power is limited practically by the hardware only. Modern software development technologies can be applied for building bots that in their turn can perform software development tasks.)
本文介绍了创建软件开发机器人的一般概念,并试图从现代软件开发方法的角度展示该概念.该描述由两个演示该思想的实际示例提供.(This article describes a general conception of creating Software Development Bots and tries to show the conception from perspectives of modern software development approaches. The description is supplied by two practical examples demonstrating the idea.)
本文的目的是启发读者学习现代编程技术并将其应用于现实生活中.通过这篇文章,作者只是展示了他的小想法,并希望读者通过提供反馈意见来帮助他改进文章.(The purpose of this article is inspiration of readers to study modern programming techniques and apply them in real life. Through this article, the author has just showed his small idea and hopes that readers help him to improve the article by giving him their feedback.)
如何阅读这篇文章(How to Read this Article)
为了方便读者,读者应注意本文的两个主要关键部分:(The reader, for his/her convenience, should pay attention to two main key sections of the article:)
- “想法”(“The Idea”) 包含理论描述(contains theoretical description)
- “机器人”(“The Bot”) 描述了两个软件开发机器人的实际实现(describes the practical realization of two Software Development Bots*) 因此,想要通过运行示例来了解机器人如何工作的读者可以阅读本章.(Thus, the reader who wants to see how the bots work by running the examples can read chapter*) “The Bot”)“机器人”( 第一.读者也可以看一下章节(first. The reader can also look at chapter*) “Contents”*)“内容”( 找到他/她想要的部分.(to find the section he/she wants.)
缩略语(Abbreviations)
数据中心(ATDCG) | 自动化的测试驱动代码生成(Automated Test-Driven Code Generation) |
---|---|
SDB | 软件开发机器人(Software Development Bot) |
TDCG | 测试驱动代码生成(Test-Driven Code Generation) |
TDD | 测试驱动开发(Test-Driven Development) |
内容(Contents)
想法(The Idea)
软件开发的演变(Evolution of Software Development)
激发作者在SDB领域进行研究的最初问题是"软件开发技术是如何开发的?".了解软件开发技术的发展趋势非常重要,因为这种知识有助于创建对未来的愿景.编程范例(编程技术)的先前一般阶段可以简要描述如下:(The initial question that has inspired the author to make a research in field of SDBs was read as “How the software development technologies are being developing?”. Understanding of trends of evolution of the software development technologies is important because this knowledge helps in creating vision of the future. The previous general stages of programming paradigms (programming techniques) can be briefly described as the following:)
- 命令顺序.(Sequence of commands.)在编程时代的早期,那时硬件薄弱,一个程序员就开发了一个程序.程序开发(The early stage in programming era when hardware was weak and a single programmer developed a single program. The programs were developed)连续的(consecutive)ly(ly)以非结构化的方式.(in a non-structured way.)
- 结构化编程.(Structured programming.)要解决的问题范围的扩大要求编程代码量的增加和对该量的更好的管理.这些代码被组合成块结构.(Growing of scope of the problems to be solved required growing of programming code volume and better management of this volume. The codes were combined into block structures.)
- 面向对象的编程.(Object Oriented Programming.)代码块结构不断发展,最终被组合为一种名为Objects的新型结构.代码块之间关系的数量和复杂性也在增长.引入了对象特有的新型关系(封装,继承,多态性,访问级别等).编程模型反映了复杂系统的功能,其中不同的独立单元具有状态,并且能够在一个公共环境中执行特定的操作,并且逐步接近现实生活的参与者和过程.(Code block structures grew and finally were combined into new kind of structures named Objects. Number and complexity of relations between the code blocks also grew. New types of relations that are peculiar to the objects were introduced (encapsulation, inheritance, polymorphism, access levels, and so on). The programming model reflected features of the complex system where different standalone units have state and are capable of performing specific operations within one common environment and stepped close to the actors and processes of the real life.) 问题是:下一步是什么,编程方法会朝哪个方向发展?(The questions are: what is the next step, in what direction do programming methods evolve?)
简化的TDD程序(Simplified TDD Procedure)
TDD是一种进化的开发方法,它结合了测试优先开发,即在开发或重构生产代码之前编写测试. TDD不是简单的编程技术,而是重要的敏捷性要求和敏捷性设计技术. TDD的目标是编写有效的干净代码.(TDD is an evolutionary approach to development which combines test-first development where a test is written before development or refactoring of the production code. TDD is not a simple programming technique but both an important agile requirement and agile design technique. The goal of TDD is to write clean code that works.)
TDD是解释本文主要思想的便捷方法. Ť(TDD is a convenient way to explain the main idea of the article. T)以<生物多样性公约>为基础(aking TDD as a basis)进一步的解释为描述TDCG的方法提供了一条清晰的道路.(for the further explanation gives a clear path to describe the methodology of TDCG.)
完整的TDD流程包含重构代码的阶段,这些测试可确保代码正确运行.如果只需要创建新代码,而不需要重构,则可以简化TDD过程.被考虑的简化TDD过程可以具有以下阶段:首先创建测试,开发软件单元,并可能重复开发任务,直到代码通过测试阶段.(Full TDD process contains phases where code is being refactored and the tests assure correct operation of the code. In case where creating of new code is only needed, but not refactoring is supposed, the TDD procedure can be simplified. The considered simplified TDD procedure can have the following phases: creating the tests first, developing the software unit, and possibly repeating development tasks until the code passes the test phase.)
下图显示了可能的简化TDD过程.(The following diagram presents possible simplified TDD process.)
几乎所有信息源都描述了TDD任务,但要注意以下事实:某些流程可以自动化,从而减少了人工工作.有一个重要的特征应该强调.自动化任务由成熟的算法运行,并且稳定,但是手动执行的任务可能会引入错误.换句话说,测试和软件的开发人员应对其工作质量负责.因此,可以从责任的角度描述考虑简化TDD程序的主要任务:(Almost all information sources describe TDD tasks paying attention to the fact that some processes can be automated that reduce manual work. There is one important characteristic that should be emphasized. Automated tasks are run by the proven algorithms and are stable, but manually performed tasks can introduce errors. In other words, developers of the tests and software are responsible for quality of their work. Thus main tasks of the considering simplified TDD procedure can be described from the point of view of responsibility:)
- 创建测试(Creating the tests)–是可能影响整个已开发软件单元质量的关键任务.(– is the key task that can impact the quality of the entire developed software unit.)
- 运行测试(Running the tests)–是经过验证的自动过程,它本身不会引入错误(实际上/我们假设是错误的).(– is the proven automatic process that does not introduce errors itself (in practice / we assume it).)
- 软件开发(Development of the software)–由程序员执行,但测试可确保其工作质量,从而降低了程序员对其工作的责任.(– is performed by the programmer but the tests assure the quality of his/her work that reduce responsibility of the programmer for his/her work.) 尽管本文考虑了减少程序员对其工作的责任,但这意味着仅通过测试才能保证工作质量.为了简化说明,本文不考虑其他质量指标,例如代码可读性,开发时间,代码性能.(Although the article includes consideration of reducing programmer’s responsibility for his/her work, it means that the quality of the work is assured only by the tests. Other quality indexes, such as code readability, time spent for development, code performance are not considered in this article for keeping the explanation simple.)
测试驱动代码生成(Test-Driven Code Generation)
Raphael Marvie在他的文章"测试驱动代码生成简介"中描述了测试驱动代码生成(TDCG)技术[(Raphael Marvie describes Test-Driven Code Generation (TDCG) technique in his article “An Introduction to Test-Driven Code Generation” [) 马维2006年(Marvie. 2006) ].他在TDD流程中描述了TDCG.(]. He described TDCG in the context of TDD process.)
本文将自动代码生成视为一种独立的技术,而不是TDD的一部分.但是,所考虑的技术与TDD和其他信息技术有着密切的关系.由于考虑的自动代码生成也基于先前编写的测试,因此可以将其命名为自动测试驱动代码生成ATDCG.(The current article considers automatic code generation as a separate technique that is not a part of TDD. But, the considered technique has a close relation to TDD and other information technologies. Since the automated code generation that is being considered is based on the previously written tests also, it can be named as Automated Test-Driven Code Generation ATDCG.)
上面提到的推理表明,只有运行测试是自动化的,但是创建测试和开发软件是TDD中的手动任务(很明显,这些任务可以部分自动化,但不能完全自动化).由于软件开发任务的质量(通过测试)是自动控制的,因此开发也可以完全自动化.(The above mentioned reasoning shows that only running the tests is automated, but creating the tests and developing of the software are manual tasks in TDD (strongly speaking, these tasks can be / are automated partially, but not completely). Due to the fact that the quality (passing the tests) of the software development tasks is controlled automatically, the development can also be completely automated.)
人的角色只能通过创建测试来承包.从业务角度看,这意味着人员将创建并描述软件单元的要求,并且将根据这些要求自动创建这些单元.(Role of humans can be contracted only to create the tests. From the business perspective, it means that humans will create and describe requirements for the software units and the units will be created automatically according to these requirements.)
因此,可以将自动软件开发表示为上面考虑的简化TDD过程的演变.(Thus, the automatic software development can be presented as an evolution of simplified TDD process that was considered above.)
自动化测试(Automated Testing)
自动化软件测试的经典方法具有一个称为"代码覆盖率"的特征.代码覆盖率是一种度量,用于描述特定测试套件运行时程序源代码的执行程度.代码覆盖率的小值表示存在未自动测试的代码.(Classical approaches of automated software testing have a characteristic named “code coverage”. Code coverage is a measure used to describe the degree to which the source code of a program is executed when a particular test suite runs. Small value of the code coverage means that there is code that does not automatically tested.)
ATDCG技术可以创建测试完全覆盖的代码,因为该代码是从头开始创建的.换句话说,它具有100%的代码覆盖率.因此,如果代码覆盖率是经典测试方法的良好指示,则不能将其用于衡量ATDCG的成功.(ATDCG technique can create code that is fully covered by the tests, because the code is created from scratch. In other words, it has 100% code coverage. Thus, if the code coverage is a good indicator for classical testing approach, it cannot be used to measure success for the ATDCG.)
应该引入新的指标,以通过测试来衡量实际业务问题的覆盖范围.这一事实将成功的衡量标准从软件开发领域转移到了系统/业务分析领域.(New indicator that measures actual business problem coverage by the tests should be introduced. This fact moves measurement of the success from software development sphere to the system/business analysis.)
本文将不讨论此措施,以保持阅读的简洁性,并更严格地遵循该主题.但是,有一些问题需要进一步研究,这一事实应该得到强调.(This measure will not be discussed in this article to keep simplicity of reading and more narrowly follow the subject. But the fact that there are issues requiring further research that should be emphasized.)
测试在ATDCG中的作用(Role of Tests in ATDCG)
在ATDCG中创建测试是手动执行的唯一任务.测试是自动软件单元创建过程的主要驱动力,同时确保了过程质量.因此,ATDCG中的测试具有以下特征:(Creating tests in ATDCG is the only task performed manually. And the tests are the main driver of the automatic software unit creation process and at the same time, assure quality of the process. Thus, the tests in ATDCG have the following characteristics:)
- 整个ATDCG过程和结果的质量取决于测试的创建方式(Entire ATDCG process and quality of the result are dependant on how the tests were created)
- 创建测试是ATDCG的主要敏感任务(Creating the tests is the major and sensitive task in ATDCG)
- 与传统方法相比,创建测试与业务需求的关系更紧密,与创建软件代码的距离更远(Creating the tests has more close relations to the business requirements and more far from creating software codes than classical approach)
- 需要进行研究并开发为ATDCG创建测试的方法和规则(There is demand to perform research and develop methodology and rules of creating the tests for ATDCG)
机器学习(Machine Learning)
如前所述,ATDCG开发的单元的质量完全取决于测试.反过来,测试的创建与业务需求的关系要大于编程的关系.测试很可能包含大量规则.从其他角度来看,将以声明性的方式描述测试,并包含或引用大量数据.(As it was mentioned, the quality of units being developed by ATDCG completely depends on the tests. Creating of the tests in its turn relates to a bigger extent to the business requirements than to the programming. Most likely, the tests will contain a large number of rules. From other point of view, the tests will be described in a declarative way and contain or refer to a large number of data.)
因为测试创建过程与业务需求相关,所以这些数据应具有足够高的抽象级别,以使测试创建者可以方便地基于业务需求开发测试.与传统测试方法相比,测试设计的高抽象级别和大量数据将导致复杂性的增加.(Because the tests creation process relates to the business requirements, these data should have abstraction level that is high enough to give the test creator a convenient way to develop tests based on the business requirements. High abstraction level and large number of data for the test design will lead to increase of complexity compared to the classical testing approach.)
因此,测试的创建和ATDCG的运行可以描述为:(Thus, creating of the tests and running of the ATDCG can be described as:)
- 以声明形式创建测试并考虑大量实际物理数据(例如,业务流程的索引)(Creating test in declarative form and considering amount of real physical data (for example, indexes of the business process))
- 将创建的测试或部分测试视为自动创建软件单元的培训数据(Consider created tests or part of it as the training data for automatic creation of the software unit) 这些观察结果表明ATDCG与有监督的机器学习有很强的关系.因此,在ATDCG中可以使用监督机器学习的理论和技术.(These observations show a strong relation of ATDCG to Supervised Machine Learning. Therefore, theory and techniques of Supervised Machine Learning can be used in ATDCG.)
社会影响(Social Impact)
ATDCG假定软件开发任务可以自动化,并使程序员摆脱这一角色.同时,分析人员和测试创建者的角色成为成功运行ATDCG的关键.但是ATDCG需要自身发展.而且,ATDCG的开发显然将满足Unix编程的两个规则[(ATDCG supposes automation of software development tasks and free programmers from this role. At the same time, the role of the analyst and creator of the tests becomes the key for successfully running the ATDCG. But ATDCG requires development of itself. Moreover, development of ATDCG will obviously meet two rules of Unix programming [) 雷蒙德2003年(Raymond. 2003) ]:(]:)
- 经济规则:程序员的时间很昂贵;优先于机器时间保存它(Rule of Economy: Programmer time is expensive; conserve it in preference to machine time)
- 世代规则:避免手淫;编写程序以尽可能编写程序(Rule of Generation: Avoid hand-hacking; write programs to write programs when you can) 因此,ATDCG可以被认为是一种软件开发技术,它带来了更多的机遇,但没有局限性,也没有颠覆性.同时,这也为进一步研究此问题打开了机遇和需求.(Therefore, ATDCG can be considered as a software development technology that opens additional opportunities but not a limitation, nor an overturn. At the same time, it also opens opportunities and demand in further research on the matter.)
机器人(The Bot)
机器人是"软件机器人"((A bot is a “software robot” () 维基百科(Wikipedia) ).本节描述了两个SDB的创建:(). This section describes creation of two SDBs:)
- Bot 1-最简单的示例,演示了SDB的关键概念.该机器人的性能不允许在合理的时间内获得真实的结果(Bot 1 - The simplest example that demonstrates key concept of the SDB. Performance of this bot does not allow to get real result in reasonable time period)
- Bot 2-具有改进性能的机器人,可在5-10分钟内产生结果(Intel I7 CPU)(Bot 2 - The bot with improved performance that produces results in 5-10 minutes (Intel I7 CPU))
问题(The Problem)
本文试图给出一个尽可能简单的解释,以介绍该技术的一般概念.在这种情况下,最小的软件单元可以仅仅是由一种以高级语言编写的代码行表示的简单功能.(The article is trying to give an explanation that is as simple as possible to present the general conception of the technique. In this context, the minimal software unit can be just a simple function represented by one code line written on the high level language.)
这两个示例都旨在创建一个简单的type函数(Both examples have purposes of creating a simple function of type)(f(a,b))((f(a,b)))基于训练数据的C#语言.该测试将检查每种情况下输入功能的输出值是否相等.(on C# language based on training data. The test will check equivalence of output value of the function for input in each case.)
训练数据(Training Data)
输入参数(Input arguments ()(一种)((a))和(and)(b)((b)))和输出值(() and output values ()(F)((f)))如下表所示:() are presented in the following table:)
(一种)((a)) | (b)((b)) | (F)((f)) |
---|---|---|
38 | 2 | 1463 |
4 | 11 | 80 |
51 | 7 | 2645 |
12 | 32 | 313 |
6 | 21 | 150 |
20 | 38 | 599 |
25 | 43 | 849 |
3 | 19 | 113 |
40 | 34 | 1779 |
实际上,这些数据是使用多项式函数构建的(Actually, these data were built using polynomial function)(f =a ^ 2 + 5b + 9 )((f = a^2 + 5b + 9)).这个事实可以检查创建的SDB的正确操作.在现实世界中,(. This fact allows to check correct operations of created SDBs. In the real world, the)目标功能和测试极有可能是未知的,并且可能非常复杂.(objective function as well as test is most likely unknown and can be very complex.)
机器人应找到等于上述多项式的函数.但是结果可以是其加数的任意组合.见章节(The bot should find the function that is equal to the mentioned polynom. But the result can be any combination of its summands. See chapter) 结果(Results) 看到机器人发现了一些根据训练数据执行计算的功能.(to see that the bot discovers several functions implementing calculations according to the training data.)
Bot 1(Bot 1)
如上所述,Bot 1是最简单的示例,它演示了SDB的关键概念.该漫游器的性能不允许在合理的时间内获得真实的结果.但是,在其他可能的解决方案中,代码是最简单的.(As it was mentioned above, Bot 1 is the simplest example that demonstrates key concept of the SDB. Performance of this bot does not allow to get real result in a reasonable time period. But the code is the simplest among other possible solutions.)
机器人创建类型的函数(The bot creates function of type)(f(a,b))((f(a,b)))在具有以下代码段外观的C#语言上:(on C# language that has a look as the following snippet:)
namespace Program
{
public class WorkingClass
{
public static int F(int a, int b)
{
return XXXXXXXXXXXXXXXX;
}
}
}
此代码段包含代码包含,实现在原处标记为XXXXXXXXXXXXXXXX的函数公式.机器人应找到此代码行.所有其他文本都是已知的,它们构成了可以编译到库中的完整C#程序.(This snippet contains the code inclusion implementing the function formula in place marked as XXXXXXXXXXXXXXXX. The bot should find this code line. All other text is known and forms complete C# program that can be compiled into the library.)
包含代码是使用由四个算术运算组成的字母((The code inclusion is built using the alphabet consisting of four arithmetic operations () -
,(,) +
,(,) *
,(,) /
),两个变量((), two variables () a
和(and) b
)和九位数((), and nine digits () 1
,(,) 2
,(,) 3
,(,) 4
,(,) 5
,(,) 6
,(,) 7
,(,) 8
,(,) 9
).().)
机器人实现的算法也很简单:(The algorithm that is implemented by the bot is simple as well:)
- 第1步(Step 1).通过将从字母表中随机选择的符号插入XXXXXXXXXXXXXXXX位置来构建代码(. Building the code by insertion into the place XXXXXXXXXXXXXXXX the symbols that are randomly selected from the alphabet)
- 第2步(Step 2).将代码编译到RAM中.如果编译失败,请转到步骤1(. Compile the code into RAM. If compilation fails, go to Step 1)
- 第三步(Step 3).运行用于训练数据集的功能(. Run the function for training dataset)
- 第4步(Step 4).比较实际功能输出和训练数据集的结果.如果任何情况下的值不同,请转到步骤1(. Compare the actual function output and results from training dataset. Go to Step 1 if values for any case differ)
- 第5步(Step 5).打印找到的功能(. Print the found function) 该算法使用反射和动态代码生成在C#上实现.(The algorithm was implemented on C#, using reflection, and dynamic code generation.)
性能(Performance)
简单算法的性能非常差.从字母表中提取的符号的不同组合的数量约为4100万. (如果我们使用4个操作和5个变量).简单的迭代需要巨大的计算量.如此大量的迭代无法在合理的时间段内在现代个人计算机上执行.作者设法在10天之内在Intel I7 4核CPU上运行4个bot实例来找到一种解决方案.(Performance of the simple algorithm is dramatically poor. Number of different combinations of symbols taken from the alphabet is about 41 mln. (if we use 4 operations and 5 variables). Simple iteration requires huge computation volume. Such big number of iterations cannot be performed on modern personal computer in reasonable time period. The author managed to find one solution by running 4 instances of bot on Intel I7 4-core CPU in 10 days.)
尽管Bot 1的性能非常差,但其源代码却非常简单.它的代码未作为文本包含在文章中,但可以下载(请参阅本章(Although Bot 1 has extremely poor performance, its source code is very simple. Its code is not included into the article as the text, but it could be downloaded (see chapter) 使用代码(Using Code) ).该代码非常简单且易于注释,作者希望它的可读性足以理解其工作原理.(). The code is quite simple and commented and the author hopes it is readable enough to understand how it works.)
Bot 2(Bot 2)
Bot 1可用于了解自动创建软件代码的最简单算法,并研究所需的编程语言命令.但是不能方便地查看结果.作者包括同一机器人的改进版本,并将其命名为Bot 2,以便在合理的时间内获得结果.(Bot 1 can be used to understand the easiest algorithm of automatic creating software code and study required programming language commands. But it cannot be used to see the result conveniently. The author included improved version of the same bot and named it as Bot 2 to get the result in reasonable time period.)
Bot 2实现了遗传算法,可大大减少找到解决方案的时间.它允许在运行一个线程的Intel I7 CPU上5到20分钟内获得结果. Bot 2是使用(Bot 2 implements Genetic Algorithm that significantly reduces time to find the solution. It allows to get the result in 5 - 20 minutes on Intel I7 CPU running one thread. Bot 2 is written using)一点点(a bit)更复杂(more complex)码.但是代码也被注释,应该不难理解.(code. But the code is also commented and should not be difficult to understand.)
结果(Results)
Bot 2生成的一些结果显示在下面的图片中.读者可以注意生成的C#代码和运行时间.读者可以下载源代码并自己运行示例(请参见第(Several results generated by Bot 2 are presented on the pictures below. The reader can pay attention to the generated C# code and running time. The reader can download the source code and run the example himself (see chapter) 使用代码(Using the Code) ).().)
机器人可以轻松升级以直接将创建的代码写入(The bots can be easily upgraded to write created code directly into)*** .cs(**.cs*)**文件,甚至创建Visual Studio项目结构.作者没有进行这种升级,试图使源代码保持简单.(*file and even create Visual Studio project structure. The author did not do such an upgrade trying to keep the source code simple.*)
未来发展(Future Development)
当前文章显示了创建SDB的可能性.但是现在不能在实践中使用.它可以从相关技术中受益并从中受益,例如机器学习,数据挖掘,TDD,自动代码生成等.(The current article shows the possibility of creating SDBs. But it cannot be used in practice now. It can benefit and take benefits from relating technologies, such as the Machine Learning, Data Mining, TDD, Automatic Code Generation, and so on.)
ATDCG的未来发展可能涉及构建编译器和代码分析器的经验.成熟的机器人可以创建软件单元,从而避免使用高级语言和编译阶段.他们可以创建由Microsoft中间语言(二进制表示)命令或Java字节码组成的单元.这样可以大大加快代码生成过程.(Future development of ATDCG can involve experience of building Compilers and Code Analyzers. Mature bots could create software units avoiding use of high level languages and compilation stage. They could create the units that are composed from Microsoft Intermediate Language (binary representation) commands or Java byte codes. This can significantly speed up the code generation process.)
目前,爱好者可以研究和开发ATDCG方法.关于此事的研究也应该进行.理论研究将为理解ATDCG的好处以及如何实际实施它们奠定基础.(At the moment, the ATDCG methods can be studied and developed by enthusiasts. Researches on the matter should be also take place. The theoretical research will create a base to understand the benefits of ATDCG and how to implement them practically.)
使用代码(Using the Code)
该代码包括Bot 1和Bot 2,它们是在以下环境中创建和运行的:(The code includes Bot 1 and Bot 2 that were created and run in the following environment:)
-
发展历程(Development):Microsoft Visual Studio社区2015(: Microsoft Visual Studio Community 2015)
-
汇编(Compilation):Microsoft .NET Framework 4.5,任何CPU(: Microsoft .NET Framework 4.5, Any CPU)
-
平台(Platform):Microsoft Windows 8.1,64位,CPU:英特尔I7(: Microsoft Windows 8.1, 64-bit, CPU: Intel I7) 读者可以在文章顶部或此处下载示例:(The reader can download examples either at the top of the article or right here:)
-
下载Bot 1(FuncGenerator-9 KB)(Download Bot 1 (FuncGenerator - 9 KB))
-
下载Bot 2(FuncGeneratorGenetic-13 KB)(Download Bot 2 (FuncGeneratorGenetic - 13 KB)) 这两个示例在运行时都使用一个线程.可以同时运行多个实例,但是它以最大的功耗在模式下运行CPU.如果这种负载不是为长时间使用CPU而设计的,则可能会使计算机过热. Bot 2很快产生结果,并且不应使硬件过载.但是作者不建议长时间运行多个Bot 1实例.(Both examples use one thread when run. Several instances can be run simultaneously, but it runs CPU in mode with maximum power consumption. Such load can overheat computer if it is not designed for intensive CPU use for long time calculations. Bot 2 produces result quite quickly and should not overload the hardware. But the author does not recommend to run several instances of Bot 1 for a long time period.)
参考文献(References)
- [([) 马维2006年(Marvie. 2006) ] R. Marvie.测试驱动代码生成简介. EuroPython 2006.(] R. Marvie. An Introduction to Test-Driven Code Generation. EuroPython 2006.)
- [([) 雷蒙德2003年(Raymond. 2003) ] E. S. Raymond. Unix编程艺术. Addison-Wesley,2003年.(] E. S. Raymond. The Art of Unix Programming. Addison-Wesley, 2003.)
历史(History)
- 15(*15*)日(th*)2018年12月:更改了示意图,在``简化TDD程序'‘一章中介绍了可能的简化TDD流程(感谢(December, 2018: Changed picture for the diagram presenting possible simplified TDD process in chapter “Simplified TDD Procedure” (thanks for*) @ciroBorrelli)@ciroBorrelli( ).().)
- 22(22)nd(nd)2016年11月:初始版本.(November, 2016: Initial release.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
XML C# .NET VS2015 VS2013 generation .NET-Compiler-Platform TDD machine-learning AI 新闻 翻译