How besser-pearl/besser works
Project Type and Purpose
• BESSER is a low-code, open-source platform focused on “low-modeling”. It allows developers and users to define application models using B-UML and then generate target code structures.
• It spans both domain modeling (metamodel definitions) and code generation, integrating various transformation pipelines to serve multiple frameworks (backend, frontend, mobile, and database schema generation).
File Structure
• The top-level directories include “besser” (the core Python package) and “docs”, “tests”, etc. Within “besser”, you see several key subcomponents:
• The BUML subpackage contains “metamodel” and “notations”. The metamodel defines various aspects (deployment, gui, object, ocl, state_machine, structural) that represent the different modeling domains.
• Under “notations”, you see directories for deployment, object (PlantUML), ocl, and structural (both DrawIO and PlantUML). These components are responsible for parsing and converting external model representations.
• The “generators” directory is subdivided by target (backend, django, flutter, java, pydantic, python, rdf, rest_api, sql, sql_alchemy, terraform). They take the internal model representation and produce source codes/templates in various forms.
• “Utilities” includes helper scripts, code builders, and notably the web modeling editor, which likely offers an interactive front end.
• There are many templating files (with a .j2 extension) and ANTLR grammar files (.g4) that support the parsing of modeling languages and generation of target code.
Key Components to Highlight
a. Core Modeling Engine (B-UML Metamodel):
b. Notations Layer:
c. Code Generators:
d. Utilities and Extensions:
• Supporting tools such as the BumL code builder, image-to-B-UML conversion utilities, and the Web Modeling Editor. These enhance the modeling experience and provide user interfaces.
e. Infrastructure and Integration Components:
• Deployment artifacts such as the Dockerfile and docker-compose.yml indicate that containerization and deployment are integrated. This can be depicted as infrastructure elements interfacing with the core model processor.
Relationships and Interactions
• The core metamodel then feeds into the various code generator modules.
• Utilities (like the Web Modeling Editor) interact with both the internal model and the generators to offer an interactive environment.
• External deployment tools (Docker- and Terraform-based infrastructure) are connected to the generated backend and deployment artifacts.
• Tests in the “tests” directory ensure that each component (metamodel, notations, generators) meets reliability and integration standards.
Architectural Patterns and Design Principles
• The overall structure follows a layered architecture where separate layers perform parsing (input), modeling (business logic), and code generation (output).
• Use of standardized templates (Jinja2) and clearly defined interfaces between components (for instance, the generator interface in “besser/generators/generator_interface.py”) illustrates modularity and separation of concerns.
• ANTLR-based parsers in the notations layer demonstrate the use of formal grammars to interpret domain-specific languages.