Skip to content

entityc/entity-compiler

Repository files navigation

Entity Compiler

Java 8+ License

The Entity Compiler provides a language to model entities in your enterprise application along with a compiler and template engine to synthesize code responsible for the storage, transfer and management of data relating to those entities.

The entities are specified in an implementation agnostic way, you then apply templates that synthesize the entities to code. You can write your own templates or use templates shared by others via a github repository.

Project Goals

The initial goal of the Entity Compiler is to allow an organization to standardize on a representation of the entities used in the organization and then provide the tools for each team in the organization to synthesize those entities (using templates) to their code base. This gives product features an even playing field across server and client components of the organization's enterprise application. The initial goals are:

  • Standardization of entity representation
  • Entity definitions under source management (currently git is supported) and accessible by all teams.
  • Allow each team in an organization to develop their own templates or share common templates also stored under source management and accessible by all teams.
  • Promote collaboration across all teams of a larger enterprise application.
  • Primarily targets the data layer of the enterprise application (typically boilerplate - not fun to write code) freeing up developers to spend time writing the business logic (the fun stuff).
  • As an organization builds a library of templates, building the systems those templates target is much much faster. For instance, if you construct a set of templates to build a microservice, creating a second microservice based on different entities is extremely fast.

The ultimate goal of the Entity Compiler is to allow the sharing of templates and even entities across the industry.

  • Faster adoption of technology and standards. Open source projects that wish to promote their standard (e.g., Spring Boot, Quarkus, Django, Flask, etc.) would provide Entity Compiler templates that would allow a potential adopter to quickly synthesize a starting point for their project based on that standard.
  • Promotes collaboration between teams across the industry.

Most of all, the goal of this project is to bring together people that share a vision of putting entities at the top of an organization's enterprise while also accelerating development through a synthesis of entities to code.

Documentation

Documentation on the compiler and template language can be found in the docs directory. It reads more like a reference manual than a document for learning. A better place to start for learning are the tutorials.

Tutorials

The best way to understand how the Entity Compiler works is to check out the tutorials. There are currently two tutorials:

Tutorial Description
Entity Compiler Gives you the basics of the Entity Compiler, both its entity language and template engine.
Tutorial Microservice Demonstrates the potential of the Entity Compiler by building an entire microservice along with an Web Admin Console and student website.

Libraries

The following libraries are available that support the Entity Compiler. Each has their own Github repository:

Library
Description
ec-std-lib The intention of this library is to serve as a base set of domains, languages, units, etc. that can be used with most applications of the Entity Compiler. They attempt to be language agnostic and can help to provide some standardization at a basic level.
ec-springboot-lib This library contains templates and domains specific for building Spring Boot microservices.

State of the Project

Although many working microservices have been built using this compiler and its two template libraries, they are not quite ready for generating production level code. They should be considered Alpha level - not optimized for performance, low test coverage and not functionally complete. It is certainly at a level to play with and see the capability it provides in synthesizing code. For those who wish to develop their own template library you could achieve production quality that way, but you are encouraged to contribute with others on an open source library such as the two above.

Building and Running

It is recommended to use version 3.6.0 or above of Maven (use mvn --version to get its version if it is already installed).

This repository includes a Maven project file (pom.xml). This allows you to build the project and create an "executable" jar file. To do this, open a shell and go inside the repository's local directory (aka Project Directory) and run:

mvn clean package

This will build the project and produce a directory called target. Inside this target directory there should be the built jar file ec.jar. You may want to move this jar file to a bin directory in your local account (such as ~/bin), then also have a shell script in this bin directory that wraps this jar file to appear as a command line executable. For example, you could create a file called just ec (located in your bin directory) that looks like the following:

    #!/bin/sh
    java -jar ~/bin/ec.jar $@

Of course, you will need to add your bin directory to your executable search path (e.g., export PATH=$PATH:~/bin).

Then to run the compiler in a shell simply perform: ec followed by arguments (for instance: ec -help)

Licensing

All projects of the EntityC Organization are under the BSD 3-clause License.

See LICENSE.md for details.

Contributing

Contributors are welcome in all areas of an enterprise application from database to web design. In contributing to improve existing templates or adding new ones, you are in effect improving every enterprise application that uses them to build their code.

Before contributing please read the following Contributing Guidelines.

Below are areas where substantial work has been done but where contribution could greatly improve them. Anyone new to the compiler may want to start in one of these areas.

Existing Area What is needed
Database Currently only Postgres is supported but even that can be improved. It is written not as a template but as a transform in Java code. Other database support could be developed in the same way or using templates.
Spring Boot Microservice A large set of templates already exist and allow you to build a basic microservice but it could use many improvements not to just the base microservice but also add-on features.
Bootstrap based Web Admin Console The Spring Boot Microservice library includes templates to synthesize a web based Admin Console (using Thymeleaf and Bootstrap) but the UI/UX of the console is minimal and can use a lot of work.
Testing In each of the above areas, test case development is still very much needed. This may be a good area of contribution for people who are learning the compiler. Those more familiar with the compiler can help to validate the test cases.
IntelliJ Plugins There are two IntelliJ plugins, one for the Entity Description Language and another for the Entity Transform Language, however each only support syntax highlighting. It would be way better if they also supported code completion, alt-clicking to go to definition, find usages, refactoring, etc.

The following are new areas that would widen the application of the compiler:

New Area Description
Python-based Microservice To demonstrate the flexibility of the Entity Compiler it would be great to have a set of templates to synthesize a Python based microservice.
Ruby-based Microservice Again, to demonstrate the flexibility of the Entity Compiler it would be great to have a set of templates to synthesize a Ruby based microservice.
Kotlin/Java Client API Having the ability to synthesize a network API in Java or Kotlin would make it easy for Android apps to interface with a microservice also built using the Entity Compiler.
Swift/Objective-C Client API Likewise for iOS synthesizing a network API in Swift or Objective-C would make it easy for iOS apps to interface with a microservice also built using the Entity Compiler.
Other IDE Plugins Adding support to other IDEs such as Eclipse and Visual Studio Code would be a huge help.

Code of Conduct

The Code of Conduct governs how we behave in public or in private whenever the project will be judged by our actions. We expect it to be honored by everyone who contributes to this project.

See Code of Conduct for details.