I wrote an app today

This morning I started working on a new app for creating builds for the Software Factory (SF). This afternoon I deployed it to our Kubernetes cluster, and even though it is not all polished, it is entirely usable and represents a significant improvement over the previous version.

What the app is

This app is used to create and manage builds used by the SF to generate code. The build process is composed of two parts, build definitions and builds.

The build definition is a matrix of SF solution elements by models. You can add and remove solutions, add and remove models and define if the SF should generate the item at each intersection.

Screenshot of the Build Definition page

The other part, the build, lists build definitions with destination information. And defines where to place the generated files and the remote target git repository where the generated code should be committed and pushed if generation is successful.

Screenshot of the Build application

How it was built

The building of the application is performed in many different steps. Again my tools are limited. This is why I am re-building a whole new version of the SF.

But as time goes on, these tools will become better and better.

Modeling

To start with, I had to model the applications. The current tool I use for modeling applications is quite limited, but it allows me to do several things:

  • Import client interfaces from the microservice;
  • Define all the state elements that are required;
    • Document root
    • Document children (hierarchy)
    • Static lookup elements
    • Proxy lookups
  • Define the different views and forms the and their hierarchy:
    • Root forms
    • List components
    • Item component
    • Editor component
    • Dialog forms
    • etc…
  • Allocate field type, control type, and lookups for lookup fields.

The way the modeling works, I create an application for each of the parts, one for builds and one for build definitions.

Generating Code

To generate code with the SF, a build is required. So I created two build definitions using the new models and the Angular Application solutions. Then, I linked them into a build.

Then I queued a new build and generated both applications in about 8 seconds.

The results were placed into two folders build-definition (178 files, 6,123 LOC) and build (142 files, 5,022 LOC)

Building an App

The generated code contains modules with components in them. They are meant to be hosted inside an application.

The integration into an application requires the following steps:

  • Copy application frame template into a directory
  • Copy the two generated folders into the /src/app/ folder
  • Use npm to install client packages
  • Register each application root module to app.module:
  • Add injected registration service for each

Then you end up with an application ready to run.

Editing the app

It’s almost this easy. I had a few modifications, such as creating a matrix grid for the build definitions.

It took me a couple of hours to finalize the application to a point where it was usable. I still want to make other changes, but overall that’s pretty much it…

Deploying the app

I am deploying the application to Kubernetes. This involves a few steps:

  • Create a container: The application template includes a Dockerfile and a text file with a list of commands. All that was required was a bit of renaming, then copy/paste into the terminal window
  • The application authenticates users with Azure AD, so I had to create a new client app in Azure AD.
  • Then I copied another app deployment yaml. Renamed a few things and checked it in.
  • Then I sshed into my name server and added an entry to my internal DNS.

Three minutes later, I could navigate to my new app and use it…

Conclusion

This post demonstrates the workflow I currently use to create applications using the Software Factory. Today I got over 10k LOC for free. I find it amazing that I can develop applications this fast. If I were to write all this manually, it would take at least a couple of weeks.

In the future, I will be able to fix the application model and editor to be a lot more usable and descriptive about the desired application functionality. Then I will be able to generate complete applications directly from the SF.

What is really cool about this is that I’m using the previous version of the SF to generate the next version of the SF.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: