Code generation from the domain-specific model of software design patterns

OData support
Suba Gergely
Department of Control Engineering and Information Technology

Software development companies can spare time, costs and workforce with the help of software development tools which can simplify coding processes, shorten development time and reduce the number of code bugs as well. Code generator software aim exactly that purpose as they can generate source code automatically.

During my work I designed and implemented code generator software that can radically reduce development time while solving some common problems in software development. One of the code generators I implemented is able to generate C and Java code from UML state machines and also from a domain-specific language (DSL) I designed specifically for defining state machines in a simple and clear way. The generated Java code follows the State design pattern in this case. Another code generator I developed makes it possible to use a feature called double dispatch in Java. This new feature is achieved by generating Java code following the rules of Visitor design pattern from custom Java annotations placed on method parameters.

In case of embedded software development, it makes sense to generate C and Java code of state machines at the same time from the defined domain-specific description in order to support not only embedded C code but also test and tool software developed in Java language. In this case, about 400 lines of code can be generated from a state machine defined in only 4 lines of DSL code with the help of the code generator I developed during my work. This means a significant reduction in development time, costs and in the number of code bugs as well which leads to additional reduction in testing and development time and costs.

In my thesis, besides the documentation of the design, implementation and testing of the code generator software I developed I also mention some other code generator software and research writings connected to code generation topics. In addition, I describe some software design patterns and concepts which have implementations worth to generate. Moreover, I describe some technologies which can be helpful while developing code generator tools.


Please sign in to download the files of this thesis.