WOW! Has it been 4 months already? I guess I have work to do on blogging…
This post is about what happened between my last post in December and now, in April.
I set out to create a new Software Factory (SF) solution to generate REST micro-services. I was expecting this would take a couple of weeks. The goal was to talk about that in my blog after. It took a couple of weeks, and then I generated new services for the SF component models. (11 services, 2023 files, 58,523 lines of code)
But then I needed to host those services; I had to figure out the hosting environment. Before that, I was hosting containers using docker-compose. It worked for a couple services, but I was definitely not set up for micro-services. So I decided to build a Kubernetes cluster because that is easy, right?
So, I installed Kind on an unused desktop; I had to set up a database and a message queue as containers for my services to use; that was an interesting introduction to stateful sets. Best practices recommend using external storage, so setting up NFS volumes pointing to another server was another fun activity. I also had to figure out volume claims and ingress. And I wanted to automate my deployment, so I set up ArgoCD. So another solid couple of weeks, we’re consumed there.
Now my services we’re all up and running, I could (and I do) re-generate / re-deploy them at will. But my client applications were no longer compatible with the new REST interface.
So, I create two new SF solutions to generate client libraries, one for .net and one for Angular. And then generated all client libraries. In total, I have 34 interfaces for my 11 micro-services. The C# library is (34 NuGet packages, 809 files, 38,225 LOC) and for Angular (34 npm packages, 880 files, 43,547 LOC). So I spent another couple of weeks on that.
it was time to re-write a significant portion of the Software Factory
That is good, but client libraries are pretty useless by themselves. Both the current version of the Software Factory as well as my client application used to edit the SF data we’re not compatible with the new micro-services.
While the Software Factory is a fantastic tool, and it probably writes 80% of my code right now, I had a lot of issues with it. But the main one is that I needed to be able to host it as a container in my Kubernetes cluster. In its current form, it was designed to generate files directly in my working folder on my desktop. That, combined with the change in service interfaces, meant it was time to re-write a significant portion of the Software Factory.
I spent another couple of weeks re-writing the core engine to use the new service format. While I was at it, I used the opportunity to re-factor several complicated systems to reduce coupling and make the code more manageable. There is still work to do, but I need data before I can complete and start using this new version of the SF.
The SF is a data-driven mechanism. It needs access to large amounts of data in the form of models, and solutions, build information and generate a lot of results. I already have this information available in the current version of the SF. I needed to move this data into the new micro-services.
So I created a migration tool to move data from the current SF services into the new SF micro-services. Of course, it is not a one-to-one migration, and I had to fill the gaps.
Having data is great, but I needed to be able to manipulate it. The client applications I was using were not compatible with the new client libraries, so I set out to update my fleet of client applications.
Re-writing all those applications is a lot of work. And, because I don’t like to write code when I can generate it, I looked towards the SF for help. I already had a prototype SF solution for creating Angular applications. So I spent a couple of weeks tweaking the solution and tried to generate as much of my client applications as possible.
The SF is a tool I use every day
It turned out to be a great help. So far, I have generated 9 Angular applications (1215 files, 41,666 LOC). The generated code is about 80% usable without modification. I then have to manually integrate them into a framework that I created and fix it to ensure that functionality works as I expect it. So far, I have 4 of those applications deployed to the Kubernetes cluster and working.
The SF is a tool I use every day. I use it to create the next generation of the SF, which will allow me to generate even more and better code. In the past 4 months, the SF generated 150K LOC that I didn’t have to write on this project alone. But the best part is that I can re-use this mechanism to generate more micro-services, client libraries, and Angular applications.
Before I started writing this post, I knew I had been busy, but writing it down made me realize the scope of everything I have done; now, I understand why I found it challenging to find time to write a blog post. Hopefully, I will be more diligent about that in the future…