In this article, we are going to examine Telosys, a code generation tool. We will do that by talking with its author, Laurent Guerin. This will give us the possibility to learn also about his views on code generation and what its users have accomplished by using Telosys.

Why Are Code Generation Tools Relevant?

Code generation is the simplest and most used technique in model-driven development. We use a source of information, a form of model, and we combine it with some template to obtain a generated artifact, for example, code.

Personally, I consider code generation as a useful entry-level step into more advanced techniques. Because of this, I think that it is very important to create simple code generation platforms that lower the entry barriers for new users.

As a community, we want to move as many developers as possible from writing repetitive code to looking for smarter solutions. If we make code generators accessible and effective we will "save" many developers and bring them on the model-driven development and language engineering side.

So usable and well-rounded code generators like Telosys are extremely valuable to the language engineering community.

This is why I think it can be very interesting to chat with Laurent. He, as the author of Telosys, is in a great position to explain to us what problems people try to solve using code generation and what is relevant to them.

The Big Picture

Could you tell us a bit about yourself?

I'm a senior consultant with 30 years of experience in software development and architecture. I've worked in different IT services companies like Steria, T-Systems, [and] Sogeti Consulting. In my career, I have held different positions: developer, project manager, software architect, expert, innovation leader, [and] consultant. I'm passionate about software engineering, DevOps, software craftsmanship, and code generation. I'm also a part-time teacher at Nantes University.

We got in touch to talk about Telosys, your code generation system. Could you describe the project to our readers?

Telosys is a "lightweight code generator," I mean a "pragmatic tool." I created this code generator to provide developers a simple and easy-to-use tool. Telosys is designed to be usable by everyone in any type of situation. It allows [devleopers] to generate any kind of language, so it is a code generator adaptable to all types of projects. Moreover, all the components are free and open source.

For more information, you can visit the website.

By the way, compliments on the website of your project; it is very clear and nicely designed. I will suggest our readers to take a look.

Using Telosys from the command line





Building Telosys Why did you need to build this project? A few years ago, I noticed that developers spent a lot of time coding repetitive and uninteresting portions of code. This is a general problem that we encounter on all types of projects regardless of the development language. This is especially true during the startup phases of a project. So, I first worked on the factorization of the generic code by creating frameworks and libraries to minimize the volume of code to write manually. But there are still many components with a repetitive structure that must be created manually by the developers (screens, controllers, DAO, unit tests, etc.). Only code generation can reduce this workload. But the "classic" tools (MDA tools, etc.) are usually quite heavy and complex to use (most of them require UML models) and therefore, it is not profitable to use them for small or medium projects. So, I started writing a code generator that does not require a UML model and that can be easily used by developers either in an IDE or with a simple command line. The first use of the experimental version of Telosys allowed my team to generate the entire persistence layer of a Java web application in 2 days instead of the originally estimated 52 days., which encouraged me to continue my work and that is how Telosys was born. Could you tell us how Telosys differs from other code generators? First, Telosys was created by developers for developers. It just aims to be pragmatic and efficient. The conception and development are governed by some basic principles: it must be simple, easy to use and remain light

it must be 100% open source

it must be able to generate code for any kind of language or framework

the generated code must have zero dependencies on the tool (to be able to stop using the tool at any time without impacting the project)

developers must be able to adapt templates easily with any text editor

developers must be able to define the project entities with a "lightweight model" (no UML model required) So Telosys can be considered as a tactical tool. It's not a strategic choice with a big impact on projects organization. You can install it, use it, and delete it whenever you want. Of course, you can also use it from the beginning to the end of the project and capitalize on the models and templates, it's up to you. What are users typically doing with your software? Some users just generate code using existing templates. Others have created their own templates library and are regularly improve it. A user has replaced a proprietary and expensive code generator with Telosys to generate his C# web applications. Another uses Telosys for microservices deployed in the cloud with Docker. Sometimes Telosys is also used to learn a new language. For example, if you know how to create a REST backend in Java and you wonder how to do it in Python, just install the Python templates and generate the code. As you can see, the uses are very varied. You provide integration of your tool in the Eclipse IDE. How difficult was it to create the Eclipse plugin? Eclipse plugins development is not very easy. Especially when you need to create different kind of visual components like editors, views, properties editors, help pages, etc. To be efficient you must master many concepts and APIs: the plugin architecture,

the specific API to access workspace resources,

the SWT library for graphical components,

events and tasks management,

the deployment on the Eclipse Marketplace, and so on. But once everything works it's very comfortable to use Telosys with Eclipse, especially for templates bundles creation. Why Eclipse? Do you plan to support other IDEs? Eclipse has been chosen because at the start of the project it was the most-used IDE. At the very beginning (7 years ago) the first version of the generator was embedded in an Eclipse plugin and directly coupled with the model editor. Now, the basic components are clearly isolated from the GUI. The features are callable using an API, so it is possible to integrate the generator into any Java application. Telosys can also be used with Visual Source Code and Atom in association the command line tool. Some extensions have been created for these IDE to provide specialized editors for Telosys files. I think that it would be nice to have a Telosys plugin for all the Jetbrains IDE (IntelliJ, PyCharm, PHPStorm, GoLand, etc) but right now I don't have enough time to work on that. Maybe next year.

Using Telosys with the Eclipse plugin