Applying Code Generation Approach in Fabrique

So it's time to have a more detailed look at Fabrique's design and major component parts to see how they solve these issues. Refer to the following diagram:

figure 2

Visual Fabrique an IDE for creating, editing, and refactoring the Fabrique Application Model. Visual Fabrique is based on IntelliJ IDEA™. In addition to IDEA's intelligent capabilities for Java code editing, Fabrique provides visual editors for model languages. Of course, it fully supports specific its own languages with code search across the project, code completion, error highlighting. etc.

Fabrique Application Model a high-level platform-independent description of a Fabrique Application. It's described with various declarative as well as imperative languages (which we will consider further later on).

Fabrique Compiler a code generator. It generates all necessary Java source code ready for compiling into a deployable application, and runs the Java compiler for those sources. The generator always generates two kinds of source code:

Fabrique Core Frameworks contains runtime code which drives the built and deployed Fabrique application. It contains the following parts:

So the two extra players mentioned previously are:

Fabrique Application Model

The point of application model is that it's a platform-independent description of an application. A Fabrique application model can consist of:

It's the job of Fabrique Compiler to generate all of the above into compliable Java code, to run the Java compiler against that generated code, and to prepare a deployable application.

Active Libraries

Needless to say, extensibility of an application is an important thing. In Fabrique there's a notion of Active Library, which is the way to contribute to Fabrique. We can contribute lots of things: from the runtime appearance of controls to a new editor for Visual Fabrique. An independent vendor can, for example, provide a new language for defining whatever it wants, a visual editor for that language, and a code generator to make it sensible at runtime.

Separation of Development Aspects

So, the whole point of Fabrique is clear separation of several development aspects:

The rest of this article is devoted to an overview of Fabrique's Business Object Framework (BOF). With this example I will try to show benefits of this separation of development aspects as well as the code generation approach in general.

Kirill's photo

Kirill Kalishev

Kirill is Senior Software Developer at JetBrains. He was instrumental in the creation of the company's award-winning IntelliJ IDEA IDE. He now works on core parts of the Fabrique project.

Contact Kirill via email: kirill(.)kalishev