As discussed in our previous blog Modernizing Web Forms to .NET Blazor (greatideaz.com) modernizing web form applications shouldn’t just be about a simple form by form user experience update.
In this blog we will focus on modernizing the underlying software architecture of the web application.
Over the past decade, the trend has been to move away from monolithic applications towards microservice based approaches. In parallel with this has been the emergence of Document or NoSQL databases as alternatives to traditional relational databases.
An architectural approach that builds on these trends is Data Agnostic Services.
The primary feature of Data Agnostic Services is that the type of data that needs to be stored by an application becomes irrelevant (Data Agnostic Record Storage). It doesn’t matter that the record defines a vehicle, person, insurance policy, or patient. It’s just a record that needs to be stored. This builds on the emerging trend of document databases to store XML or JSON record fragments. The trick here is that it’s not an “either-or” situation – NoSQL or Relational database. A better solution can be achieved by using a hybrid approach. You store the record agnostically using XML/JSON and then create read-only relational lookups so that you can query it efficiently. Making the best use of CQRS and the WORM nature of your data to build the optimal record storage solution.
Given that we have data agnostic record storge, the next step is to adopt a Single Page Application (SPA) style. The key idea here is that the website user experience is dynamically rendered as the underlying data changes. Common frameworks in the website application development space include Angular and React. However, we can go quite a bit further by creating platform agnostic dynamic page builders. Here we combine a form definition with a data agnostic record to dynamically create a user experience that could be rendered on any platform. By generating the structure of the user experience on the server we get secure and direct access to the underlying record storage. This gives us excellent security, scalability, and performance – page definitions can typically be constructed in tens of milliseconds. The user experience structural definition is then passed to the client for rendering. The Blazor WASM framework is an excellent example technology for this as it fully leverages the available resources of the client to render the user experience.
Now that we have data agnostic record storage and a dynamic page builder to render the user experience across any platform, we need to address adding workflow. This is where the microservice architecture comes in. We need to implement a simple common Rest API style so that the workflow services can be called by the dynamically rendered user experience for any type of record. Given that the workflow services are now completely divorced from the user experience and record storage they can be deployed independently. This means that workflow services can become much smaller than traditional microservices (which also tend to store the data they operate on). These nano-services:
- are invoked as required by the user experience,
- directly access the latest data from record storage,
- write the results back to record storage, and
- report success/failure.
By giving each nano service direct access to record storage we avoid many of the pitfalls of micro-service approaches which have issues with data concurrency, caching, latency, etc. This means that nano services can be developed, tested, deployed, and scaled as small discrete functions reducing cost, risk and time to market.
Data Agnostic Services builds on emerging trends in software architecture. New development can take advantage of this approach to deliver applications significantly faster with reduced costs and risks. This is particularly timely when we consider the large number of .NET Framework 4.x Web Forms applications that need to be modernized in the coming years.