Logo
Nazad
M. Vuković, V. Vujovic, S. Milinkovic, Zorana Staka, Sava Cavoski
0 19. 3. 2025.

From Visual Model to Source Code: Automated Fluent API Development Using Template-Based Code Generation in DSL Tools

The fluent API, also known as Internal DSL, is one of the concepts introduced primarily for the purpose of increasing readability and maintainability in the process of software development. It is most commonly used when there is a need to perform operations according to precisely defined rules that determine their possible orders. However, implementing a Fluent API by manual coding can divert focus from defining these rules toward technical implementation, increasing the risk of errors, unexpected behavior, and higher development costs. To address these challenges, a model-driven engineering (MDE) approach can be applied, enabling the visual design of the Fluent API model and its transformation into a code skeleton.This paper aims to present how the previously created graphical development tool, implemented as a Microsoft Visual Studio extension for modeling Fluent API, can be enhanced with model-to-text transformation in order to provide code generation of a fluent API structure. That objective is achieved by using the template-based code generation technique, implemented by enabling the execution of the appropriate T4 text templates. The proposed approach is validated by demonstrating a real-life fluent API example's code generation from its model, resulting in C# source files that contain classes, interfaces, and their corresponding methods.

Pretplatite se na novosti o BH Akademskom Imeniku

Ova stranica koristi kolačiće da bi vam pružila najbolje iskustvo

Saznaj više