5 Tips for Creating a Data-Driven Architecture
Mark DeRosa
2025 FORUM IT100 Award Winner | Data Analytics Evangelist | Innovative Thought Leader | Master Problem Solver | Agile Expert
Introduction
This article provides an overview of a technique that has proven useful over many years (yet most projects/people rarely use it). This article is not an exhaustive description of each and every detail required to implement a data-driven architecture; doing so would be very lengthy. Besides, one size does not fit all, so any attempt to provide that level of detail here would be far too presumptuous. My hope is that this article triggers some ideas on your end to help you design and build more resilient systems that are easier to maintain and serve your customers better.
What is a "Data-Driven Architecture?"
A data-driven architecture (DDA) is a solution whereby the information/values displayed in a system and the system behavior are determined by metadata. And this metadata is easily updated to implement changes dynamically within the system without rebuilding the application and deploying code. Only database changes are needed to change displays and/or behavior at a moment's notice. The idea is to decouple business logic from code and use data to drive the system. However, code provides the construct for using the data to manage the user interface/user experience (UI/UX) and system behavior. Think of code as the container and data as the contents in the container.
Why would I want to build a "Data-Driven Architecture?"
We've all worked on systems that have evolving requirements and shifting priorities, so anything we can do to accommodate those changes makes life easier for us and better for our clients. We want simple updates to be simple and our clients want seemingly simple changes to be quick. DDA does just that … it allows us, as developers, to rapidly implement predictable, or semi-predictable, changes using a proven infrastructure.
What kind of things can be controlled with a "Data-Driven Architecture?"
Okay, at this point you know what DDA is and why DDA is valuable. But what kind of things can you control with this approach? Short answer is anything you want! Longer answer is anything you want that doesn't impact performance too much and doesn't over-complicate things unnecessarily. Here are some examples to give you an idea of where data can drive processes:
Helpful Tips
Tip #1: Identify the system attributes you want to control dynamically.
Proper requirements analysis should reveal potential areas that could benefit from dynamic behavior. These areas are generally characterized by statements such as:
You get the idea, things that seem volatile either because they are fluid or contract/expand based on business circumstances (e.g., fiscal year rules, dollar thresholds, pre-defined lists of values, role-based access controls, etc.).
Tip #2: Create reference tables to store metadata that drives system behavior.
Create database tables to store code-value pairs where the code is the primary key and the value(s) are the description(s). Create values for short descriptions and long descriptions because some screens/reports may use the short description, such as for drop-down list boxes, whereas other screens/reports may use the long description to provide more information. Also include a sort order column to order the values in the front-end because alphabetical is not always the desired order. For example, you may have a list of values that includes 'Other' and you want 'Other' at the end of the list. If any values begin with 'P' or beyond, then 'Other' will be nestled in the middle of the list. Adding ORDER BY sort_order to your SQL SELECT statement retrieves the list of possible values in the order desired. Here's a sample reference table followed by sample reference data.
领英推荐
For environment configurations, you can create a reference table to store environment-specific settings. For example, maybe different SMTP servers are used in each environment for sending e-mail messages within the system or different URLs are used for references to SharePoint sites/Google Docs. All of this can be easily implemented in the DDA to avoid hard-coding in release builds for simple changes. You should NEVER modify code for the purposes of getting the system to work in another environment! Remember, your goal is to write once, deploy anywhere.
Tip #3: Develop abstraction layer to interface with domain data.
Create database views to access domain data (i.e., business data, not reference data) that allows you to control how the data is joined, converted, and returned as a ready-to-use result set. Direct table access is acceptable but always consider the option of using views. Views can protect the front-end (screens & reports) from innocent changes and allow business logic to change in one place … the view. For business logic that determines if something is true or not, use database functions. And for business logic that needs to perform a series of steps, set values to arguments passed by reference, and/or return result(s), use stored procedures.
Database views, functions, and stored procedures all provide a level of abstraction that makes it possible to implement changes in the database with little to no impact to the front-end code. Deployment of these changes are much simpler and quicker because there are no builds or releases to prepare since they are simple database updates. And that doesn't mean we are abandoning or circumventing change management processes and source code control, it just means that the entire process finishes quicker with greater confidence.
Tip #4: Develop front-end, and any APIs, to use the abstraction layer and reference tables.
All front-end code, whether it's screens/webpages, reports, or dashboards, should use the abstraction layer. And more importantly, the abstraction layer should also be used for system-to-system interfaces. Two or more independent systems requiring integration should use this abstraction layer to streamline exchanges and mitigate unintended impacts to each other. The abstraction layer not only prevents the need for each system to [unnecessarily] understand the inner-workings of the other but also protects each system from potentially harmful changes. The published Application Programming Interfaces (APIs) for each system safely control the entry/exit and what can/can't be done between systems.
Tip #5: Perform purposeful test-and-fix cycles.
Make intentional changes to the reference data that will make it clear if the front-end is using DDA or not. Areas that do not pass testing are areas that need to be reviewed, fixed, and re-tested. You should plan on several iterations of testing to make sure DDA is properly implemented throughout the system. Here are a few examples to test the implementation:
This testing will pay many dividends later because once DDA is implemented and working, future metadata changes won't have to be tested. A quick check of metadata updates can be easily done and then deployed, which is why it's critical to do thorough testing before-hand. Skimping on testing will cause more work, and re-work, later, so do proper testing! Doing so will reduce your sustainment efforts, accelerate delivery of changes, and please your clients.
Summary
These five tips should be enough to get you started on your journey of designing and building systems driven by data. The little bit of extra thinking and designing up front will save lots of time in the future. Once the construct is built and tested, it's a matter of simple database updates.
In closing, here are the key benefits of using DDA:
I hope that's enough to get you started on your journey to building a robust system driven by data more than code. Feel free to drop a comment or send me a message if you have any questions.
Senior Consultant at MetaPhase Consulting
3 年Very valuable and to the point! What takes years of experience is summarized here!