The project

In my previous post, I briefly introduced my vision of code generation and that I intend to scale code generation to build entire systems and applications.

To achieve that, I needed a tool that specializes in generating code. At the time, there were few options. Whatever I could find was either too expensive, did not scale, was way too constraining for my objectives, or a combination of the above.

Since I did not find the tools to do the job, as any good software developer would do, I had to build it. Easy right? I would do this in my free time, and be done by the end of the week…

There is a slight problem: Modelling software and code generation are complicated. Actually, it is REALLY complicated. If it was easy, everybody would be doing it.

So this is my personal project. I started working on this in 2003, I think. I’ve been working on this in my free time on and off for the past 15 years. I have never released it for various reasons. It has evolved tremendously. It was a fantastic learning experience, and it still is. It has reshaped my vision of what software is and how it is built.

In the beginning

I started the easy way: By creating a Visual Studio extension.

Visual Studio provides a lot of functionality, so I got a lot of stuff for “free”:

  • Visual Studio main purpose is managing and hanlding code
  • Source control integration
  • Built-in templating using T4 templates
  • It’s extensible and has an SDKs to create models, designers, anything you want.

It was a no-brainer. So I created a new model type, created a designer, and generated some code. Awesome! 12 months well spent. The experience was quirky, but I’ll fix that later.

So what’s the next step? How do I deploy this? Wouldn’t it be nice if I could run this on a server? How do I create more models? How do I manage all my templates? How do I associate templates with model content? How to manage all the control information?

That’s when the fun began…

Moving out

Clearly, I was kinda stuck in Visual Studio. It was time to move out.

My target was to move to a server. So I started a new Asp.Net project.

But Visual Studio assets do not like to run outside Visual Studio. I had to extract this information somehow. So I used my code generator to bootstrap a model from the VS model and generated all the code I needed to create database schema and data access objects (DAO). Then I migrated as much information as I could from the VS implementation into the database.

Cool! All my information was now in the database.

I then exposed the model as a web service and had to create a front-end application to edit the models. Time to learn WPF I guess…

There was kink though. In order for the T4 template expansion to work, I needed to run the Asp.Net application in Debug in Visual Studio. Also, I needed to run it on my computer because the code was generated directly on my hard drive.

In addition, because I didn’t have a user interface, managing the control data had to be done by editing data directly in the database tables. Fun stuff…

And this went on for several years…

The project

I really needed to get out of Visual Studio for good. So I started a big project: I would entirely re-write the Software Factory and use the current version to generate the next version of the software factory.

On the same occasion, I would add support for multiple models, I would improve the control system, and I needed to be able to generate multiple outputs.

I created multiple models to support the different information required by the Software Factory, I used the models to generate services and clients. I could now host all this information independently. The models, the templates, all the control information moved to the services. It wasn’t perfect, but it was much better.

I also could use the generated clients to build front-end user interfaces to manage all that information.

But, I had a problem, the generation engine was still tied up to Visual Studio. I tried many ways to re-use the Microsoft T4 engine, but I couldn’t get it to work without VS. So I had to write my own T4 template expansion engine.

By that time, the Software Factory was generating pretty useful code.

Switching OS

At some point, I decided I needed to move out of Window. By that time, I was using VS code, and I really had no reason to stay on Windows. So, we’re moving to Linux…

But all my quirky UI tools we’re written in WPF. So I had to re-write them. I needed to find a more flexible and portable technology. I wanted to move to the web, so set out to re-write my WPF tools into quirky Angular applications.

So first I needed clients, so I created a new solution in the Software Factory to generate Typescript clients for Angular for all of my components.

Up until this time I had worked with a single model type the Component model which essentially is data structure + interface. So I created a new model type the Application model to describe applications.

Since this was the first version of the Application model it wasn’t really complete and had issues. But, it still allowed me to write almost 50% of my Angular applications.

This Software Factory thing was becoming useful…

Back to the present

I have been thinking long and hard about how to package it up so it could be useful to others, not just me. And this is what I have been working on for the past year.

So far, I have been the only one using this tool. Usability had not been a priority for me up until now. But it’s gotten to the point where I think it might be time to release it in some way.

There are a lot of obstacles to this right now. The biggest is probably usability. For this purpose, I’m working on the next version. It’s going to be exciting, it’s going to open up a whole new world of possibility. Including the possibility to share it with you.

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 )

Google photo

You are commenting using your Google 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: