50+ different concepts as code

Mike's Notes

From Patrick Debois. This article is now rescued from the Internet Archive.

Resources

References

  • Reference

Repository

  • Home > Ajabbi Research > Library >
  • Home > Handbook > 

Last Updated

18/05/2025

In depth research and trends analyzed from 50+ different concepts as code

By: Patrick Debois
Jedi.be: 23/02/2022

We all know “infrastructure as code”. It is expanding to bigger constructs , devsecops, workflow , data , documentation, and slowly getting into the business domain. I analyzed the trends from over 50+ concepts “as code”. Do tell me what I’m missing.

As code trends summary

Here’s the TL;DR of the trends:

  • Constructs are getting bigger: we are combining multiple parts in to bigger concepts
  • DevSecOps as code explosion: security is working it’s way into the code constructs
  • Capturing process workflow: not just the infrastructure but also how we act/react to situations
  • Shift “regular” code to declarative code: some aspects can better be defined instead of being coded
  • Data as code: with the advent of MLOps, DataOps, the lines between code and data are blurring
  • Capturing knowledge as code: documentation, architecture and other aspect are becoming part of coding
  • Closer to the business: service levels, business experiments are increasingly getting defined as code


As you can see, expansion is still strong. The concept is now so embedded in our thinking that it feels the natural thing to do. It’s interesting that at the same time as we are expanding “as code” , the term NoCode is resurfacing in our industry. I guess it’s more about “less code”, or more bang for the buck per line of code. Though the concepts of “NoCode” and “NoOps” are just a pipe dream, it makes things more accessible and easier to work with , I’m all for it!

Please read on for a more detailed listing of all the concepts I found. I was surprised with new new findings and I’ve been monitoring the space for a long time.

Is “as Code” the new Model ?

This blogpost started while researching how we think about models in IT. In the old days we would have UML diagrams representing how things work. Maybe it was the Agile manifesto that urged people “Working software over comprehensive documentation”. So code is the new model these days ? As a exploration to see what models , ahum , code are available these days in the IT industry, I sent out the following tweet:

Semantics are getting fluid

I was surprised at the creativity of people’s responses and ideas so I thought it’d be valuable to summarize the feedback:

  • “software defined” is considered an alternative name to “as code”
  • the term “as code” is sometimes perceived as developer centric , yet aren’t we all developer now
  • it is interrelated to DSL (Domain Specific Languages)

People these days seem to take a relaxed view on things being “as code”. It doesn’t matter if it’s YAML or a program language. And even for that matter just data: Infrastructure as code (IaC) and Infrastructure as data (IaD) are often used interchangeably. Reminds me of Lisp where the lines between code and data were also fluid.

Anyways , what people seem to care about:

  • version controlled : able to refer to a specific version
  • repeatable (automated) process : a version can be consistently reproduced
  • easily review changes : most prefer text yet given the right viewer it means human comprehensible change
  • favor declarative over imperative: we prefer to define the future state, not the whole execution in between. Though I personally think sometimes that you want to capture just that.

See how Gartner sees the declarative market or Dan North explaining declarative in the context of a DSL

”Code” is short for “encoded knowledge” IMHO. A config file is distilled source code. Yes. A yaml is IaC - @danbjson

Another way of viewing it how Juan Flores puts it :

For me it’s runtime config. If it’s code, you should be able to test it. Can you test yaml configuration?.

This does raise the question if tests as a concept are required in the concept of Declarative . It’s another one of this outstanding debates whether you test things you define ; I’ve seen the f.i. thje need to test combinations of multiple roles applied to the same node. It would not test the code that puts it into that state, but I’d have to test the combination (Business logic?) I create myself.

Intermezzo : the fun section

Before we dive into the long list of thing I’ve found , I thought we needed a little break ; here’s some gems I found that did not make the serious list:

  • No Code aka No Programmer as code
  • Bugs as code aka Developer as code
  • Code as code aka Bots writing code
  • Chaos as code aka Another day in the office as code
  • ASCII code aka Characters I see

Shout out to @Sam Aaron who promotes “Music as Code”: Related to the concept of Algorave , SonicPI is a great way to make music in realtime while writing beats as code.

And why stop at code? Have a look at The Folders programming language - No code, just folders. More languages like this can be found at https://esoteric.codes/ : Languages, platforms, and systems that break from the norms of computing.

Now we got the fun out of the way on to the real meat of the post: Everything else as code. Note that I tried to link to an article mentioning the flavor of “As code” , google to find more products in that space.

Infrastructure as code and friends

While tests as code (although I never saw that term), were arguably the first as code, it was the concept of Infrastructure as code that popularized the notion. Ruby as a programming language making DSLs easy to create played a big part in this.

Starting with CFengine, Puppet , Chef, Ansible, Salt , Terraforma and now Pulumi this evolved into this popular notion of as code. Technically they all had a mixture of config, code and data that allowed them to spin up infrastructures in a repeatable way (often related to the concept of idempotent code.

Many different specific aspects (storage, network…) spun off and created their own language.

[TABLE]

As code flavor Description

Infrastructure as code managing and provisioning computer data centers through machine-readable definition files

Storage as code / Software Defined Storage defining the allocation of storage in a programmatic way

Network as code / Software Defined Network setup of network components by defining the state

Software Defined Hardware (SDH) runtime-reconfigurable hardware and software that enables near ASIC performance

Configuration as Code (Gitops) Everything that is a configuration change moves through the CI/CD process

Yaml as code (Kubernetes) Standardized way to define cross-cloud cloud-native components

Bigger and Higher level Constructs as code

As code is still expanding beyond the traditional cloud production infrastructure to other parts such as the CI and test environments ; now even defining test infrastructure in code and developer laptops environments.

At the same time there is movement towards combining other concepts as code into a bigger construct such as Platform as code, Environment as code and Application as code.

[TABLE]

As code flavor Description

Pipeline as code A practice of defining deployment pipelines through source code

Platform as code Allows the developers to define their own platform

Environments as code Abstraction over Infrastructure as Code and calls various Infrastructure as Code Components in the right order

Application as code Deploy the app, the infra and all the management tools around it

Dev environment as code Define a developer laptop setup as code

Test Infra as code Define the test infrastructure required as part of your test code

Workflow and Supporting services as code

Now that we got the infrastructure part under control , more and more we can define the supporting infrastructure to support the process of running the infrastructure. In addition we start codifying our workflow and our knowledge of intervention in case of issues or migrations.

[TABLE]

As code flavor Description

Dashboards as code Automate the addition of metrics dashboard/changes along with your infrastructure.

Monitoring as code Automate the entire observability lifecycle, including automated diagnosis, alerting and incident management, and even automated remediation.

DNS as code Managing your DNS configuration as code

Jobs as code Standardizing and automating job scheduling by embedding code using a simple notation that makes API calls to a scheduling engine

Workflow as code Orchestrate the processing of those tasks on different servers — in a way both reliable, scalable, and easy to manage

Operations as code Codifying operational processes into a system capable of executing them on their own.

Security as code

With DevSecOps increasingly becoming an additional driver in DevOps pipelines, it’s only natural that they have their own “as code” explosion. Parts of it are extensions of infrastructure as code theme, but we are learning that other security aspects can be expressed as code.

[TABLE]

As code flavor Description

Security as code Building security into DevOps tools and practices

IAM as code Express the roles and identity creation in code

Policy as code Writing code in a high-level language to manage and automate policies

Detection as code Systematic and comprehensive approach to software-driven threat detection, i.e. machine-readable definition files and descriptive models

Privacy as code Make automated privacy checks part of your CI pipeline

Threatmodel as code Any time someone wants to conduct a threat model, she would open a PR with her changes to a repository

Parts of the code are also being declared

Sometimes we would forget that parts of our code can just be configured/declared, instead of writing code. This is often a result of abstraction or externalization of logic to external services.

[TABLE]

As code flavor Description

Project as code Speedup the creation and maintenance of software projects with code

API as code (OpenAPI) Define the API endpoints so we can both connect our code to it and use it verify what should be allowed in and out

UI as code Instead of pixel positioning each component in code, it’s a lot easier to define these layout compare to coding

Comments as code aka Github Co-pilot Compiled from various and random github projects turning comments into code suggestions

Data being declared

Data schema changes, data quality control, data publishing. All these (past) manual changes are now increasingly done by coding them, making them repeatable and reviewable.

[TABLE]

As code flavor Description

Database as code Managing database schema changes as part of code instead of manually changing them

Data as code The ability to process, manage, consume, and share data in the same way we do for code during software development

Data bias as code / Equity as code Removing bias in data through an approach and methodological tools to impose equity controls on AI algorithm

Documentation and Architecture as code

Many have tried to generate diagrams from their “as code”. This automation always resulted in a bit of “meh”, so now we are extending documentation: just as we are doing “Test Driven” , we can also do “Documentation Driven” , documentation resulting in better capturing of knowledge: architecture, diagrams and even business directions. This complemented with Architectural Decision Records (ADR), make it seem documentation is making a comeback but now in a way that it is integrated in our workflow.

[TABLE]

As code flavor Description

Documentation as code Philosophy that you should be writing documentation with the same tools as code

Diagrams as code Code as an executable architecture description language … use of these tools in order to generate diagrams and documentation during your build process.

Presentation as code No more locked down in presentation, creating presentations is now part of writing code

Architecture as code

(Wardley) mapping as code It takes map code written in the editor and renders it as a Wardley Map

Moving closer to the business - Pipelines are everywhere

Pipelines are everywhere , not just in IT. We have pipelines in Marketing , Sales, Hiring , Legal … No wonder the “as code” paradigm is finding its way in there as well. It is a good sign we’re getting closer to the business ! Also …. a lot scarier as it involves contracts and money :)

[TABLE]

As code flavor Description

Service Level Agreements (SLA) as code Using smart contracts to do payout in case a service is working well

Service Level Objectives (SLO) as code Declaratively defines reliability and performance targets using a simple YAML specification

Law as code When translating law to code, we are turning something liminal into 1s and 0s. Sometimes great ambiguity is hidden in a comma or a word like “reasonable.”

Analytics as code Process of managing and provisioning user behavior event tracking through machine-readable definition files, rather than requirements documents

Contracts as code Automating the process of creating contracts and extracting document data

Management as code Ok … imagine that .. if you find it, let me know

Other industries

I Didn’t really research beyond traditional IT, but found this one interesting to mention

[TABLE]

As code flavour Description

CAD as code Alternative way of creating 3d models in code instead of using a UI composer

AMAZING … YOU … MADE … IT … TILL THE END

Hehe, thanks for reading. Want to support future posts like this?

Subscribe to my musings on one of the socials listed at the top.

Did you find other concepts as code? Please leave a comment and I’ll add it to the list. Happy as code day !

References to tweets

A Modern Dilemma: When to Use Rules vs. Machine Learning

Mike's Notes

This is a great article on the differences between ML and rules.

Resources

References

  • Reference

Repository

  • Home > Ajabbi Research > Library >
  • Home > Handbook > 

Last Updated

18/05/2025

A Modern Dilemma: When to Use Rules vs. Machine Learning

By: Andrew Bonham
Capital One: 06/08/2020

Machine learning is taking the world by storm, and many companies that use rules engines for making business decisions are starting to leverage it. However, the two technologies are geared towards different problems. Rules engines are used to execute discrete logic that needs to have 100% precision. Machine learning on the other hand, is focused on taking a number of inputs and trying to predict an outcome. It’s important to understand the strengths of both technologies so you can identify the right solution for the problem. In some cases, it’s not one or the other, but how you can use both together to get maximum value.

Business Logic, Calculations and Workflows

Let’s start first with understanding business logic. I’ve worked with various types of logic in systems over the years and it’s important to understand the context.

What is business logic? At its simplest form, it’s logic that contains decisions that govern a business process. These decisions are business decisions. The logic tends to be variable with the market and may change often depending on that particular industry’s drivers. The logic focuses on the why and the when. Ultimately a condition has to be true before an action can be taken.

Business logic typically leverages business calculations. Unlike business logic, business calculations tend to stay the same. They focus on the what and the how. It’s important to decouple these two from a deployment aspect as they change at different rates. As a general rule, any reusable logic should be independently deployable. If reusable logic is tied to an application deployment, it can’t be individually reused and is coupled to other components. Ideally, we want to break apart the reusable pieces of an application into microservices so they are independently reusable and deployable. See Martin Fowler’s illustration under “Figure 1: Monoliths and Microservices” as an example.

How do we connect the different steps of business logic together? Workflows.

They are the structured flow or sequencing of work tasks in a business process. Workflows can either be human-based, system-based (e.g. orchestration) or a hybrid between the two. In a previous blog I discussed when to react vs orchestrate.

Approaches for Implementing Business Logic

Now that we understand how these pieces fit together, let’s discuss some approaches for building business logic. In general, there are three different approaches for implementing business logic: Application code, decision table, and a rules engine.

Application Code

Application is a good fit when the logic doesn’t change much and is fairly straightforward.

Decision Table
Condition 1 Condition 2 Condition 3
HasSpeedingTicket HadAccident SetDiscount;
False False 20
True False 10
False True 5
True True 0

Decision tables are a good fit for logic that changes often and has a large number of conditions that are easier to manage in a table than code.


Rules Engine

A rules engine is a good fit for logic that changes often and is highly complex, involving numerous levels of logic. Rules engines are typically part of a Business Rules Management System (BRMS) that provide extensive capabilities to manage the complexity.

If we put this guidance into quadrants, it would look something like the below:

Business logic usage graph

As the rate of complexity and rate of change increases, application code is no longer suitable for business logic. Decision tables provide some relief as the rate of change increases, but ultimately a BRMS provides the best fit for high rate of change and high complexity.

Business Rules Management System (BRMS)

Let’s take a closer look at the capabilities of a BRMS by reviewing the below capability reference view:



BRMS capability reference view

Let’s touch on a couple of the key capabilities in this reference view and highlight some that also overlap with machine learning capabilities.

Rule Authoring

A Technical rule or Guided rule provides two different ways to author rules geared towards different end users. Technical rules are more for your developer audience, where guided rules consist of a point and click approach that may be better for less technical users.

A Domain Specific Language (DSL) is another capability that can enable non-technical users to write rules in an easier to use language.
Neural Networks are a form of an algorithm used in machine learning, it’s interesting to see that some BRMS have integration with this.

Rule Management

The rule repository is one of the most powerful capabilities of a BRMS. It is the mechanism in which developers can find out what has already been built and what they may be able to reuse. Rule metadata is stored here that is critical in understanding the underlying intent.

Deployment

Typically, rules can be deployed in one of two ways - either as part of a standalone service that is invoked via REST API calls, or embedded as part of the application (in-process). A little later in this article, we will see that machine learning platforms share a similar model.

Rule Execution & Deployment

Predictive Model Markup Language (PMML), or Portable Format for Analytics (PFA), are both industry standard formats for making models interchangeable. They enable you to build a model in one language or platform and port it into another language or platform that supports PMML or PFA.

***

One such example of a BRMS is Drools. Drools is an open source Apache licensed, Java-based rules engine. It supports a forward and backward chaining inference engine that leverages the PHREAK algorithm. This inference engine comes in handy if you want the rules engine to decide the order of your rules. Drools provides guided rules, technical rule DRL syntax, and support for Domain Specific Language (DSL). Drools also supports both in-process and standalone deployment models.

Machine Learning Platforms

Now that we have a good understanding of Rules Engines, let's compare them to Machine Learning Platforms. In a previous post, I provided an overview of what machine learning is and how you can use it with open source BPM. In a similar post, I explain how you can use machine learning with Akka. Let’s now take a look at a capability reference view for a machine learning platform.



Machine Learning Platform Capability Reference View

Let’s touch on some of the key capabilities and again tie back to similar overlap with the BRMS view.

Data Ingestion

Data is the most important thing in machine learning. Your model is only as good as your data. You want as much data as possible and that may include both batch and real-time data sources.

Feature Engineering

Features are the inputs into models and some ML Platforms provide capabilities for you to create those features. Others provide capabilities that can automatically generate the features for you.

Modeling Paradigms

These different algorithms can be used in a machine learning model. An important thing to note here is they aren’t tied to Supervised, UnSupervised, or Reinforcement Learning categories, rather they can be used across all three.

Deployment & Execution

You will notice some similarities to the BRMS capabilities in this space, specifically in-process and standalone REST API deployments along with support for PMML.

Management

One of the most important aspects of managing a machine learning model is monitoring it for accuracy. A common fallacy with machine learning is that a ML model never needs to be retrained as it can learn itself. That is not the case as machine learning models have to be re-trained every so often as the data they are trained on starts to drift from the data they are executing against in production.


***

By comparing the capabilities of machine learning platforms with rules engines we can now see how there are similarities along with differences at the capability level. Given how products in these areas are continuing to become closer together, it’s understandable how the choice between the two can be difficult.



Comparison between rules engines and machine learning platforms

Guidance for When to Use Rules Engine vs. Machine Learning

So how do we make the decision of when to use a Rules Engine or Machine Learning? To answer this, let’s answer this question from the dimensions of logic, logic type, what creates the logic, and data. Rules are a good fit in the situation where:

  • Logic: Exact logic is known. With rules you know ahead of time the logic you want to execute.
  • Logic Type: Precision based. If then business logic is precise and does not involve any predictions. It results in boolean type outcomes based on evaluation of facts.
  • Logic Creation: Done by a human. Software Engineers or business users create the rules that represent business logic.
  • Data: Don’t need to automatically derive the logic from the data. Analysis typically occurs on data beforehand to determine what the exact logic should be.

Now, let’s look at machine learning using these same dimensions:

  • Logic: Exact logic is not known. Rather the inputs/features that are significant in creating a prediction may be known.
  • Logic Type: Prediction based using algorithms.
  • Logic Creation: Created by machine learning software that runs using algorithms via training.
  • Data: Is used to ultimately generate the model logic. Is the most important thing in machine learning. You want to use as much data as possible and also make sure the data is unbiased. If the data is biased, then the model will become biased.

In summary, leverage rules when you need precision and know the logic. Leverage machine learning when you want to predict something but don’t know exactly how.

But is it always as clear cut as that? What if you wanted to use the power of both? The answer is you can. There are a number of hybrid patterns where you can use machine learning and rules together to determine an outcome. Let’s look at an example use case.

Patterns for Using Machine Learning and Rules Engines Together

Imagine the use case where you are a realtor wanting to provide the best guidance to your clients on purchasing a home. Maybe there are several they are interested in, but aren’t sure how quickly they should act. Let’s walk through three different patterns for combining machine learning and rules together to achieve this.

Pattern 1: Leverage machine learning outputs as an input into rules

In this pattern, two different machine learning models execute. One determines the probability of a house selling in 10 days. Another determines the probability of the sellers dropping the asking price. Both of these predictions are an input into rules. The rules then evaluate the output of the model and ultimately provide a recommendation to the realtor. Specifically, if the probability of the house selling in 10 days is greater than 50%, and the probability of the sellers dropping the price is less than 50%, then this pattern makes a specific recommendation for the realtor.



Pattern 1: leverage machine learning output as an input into rules

Pattern 2: Leverage rule outputs as a feature input into machine learning models

In this pattern, we start with the rules being the input into the machine learning models. Rules execute business logic to determine boolean based values. Does the house need repairs? Is it the selling offseason? Do the sellers want to get rid of the house and sell it now? The output of these rules then are features into the machine learning models. The machine learning models then provide a probability back to the realtor of the house selling in 10 days and the sellers dropping the price. Notice in this pattern there is not a recommendation back to the realtor, rather the probability is provided and final recommendation left up to the realtor.


Pattern 2: Leverage rule outputs as a feature input into machine learning models


Pattern 3: Leverage both rule and machine learning outputs as inputs

In this pattern, it follows a mix of the previous two patterns. Both rules and machine learning outputs are inputs into a machine learning model. In this scenario the probability of the sellers dropping a price is an input into the probability of the house selling in 10 days. This pattern also leaves the ultimate recommendation up to the realtor.



Pattern 3: Leverage both rule and machine learning outputs as inputs

An Example Implementation

Now let’s apply these patterns to an actual proof of concept. I am going to build off of a previous reactive microservice machine learning proof of concept that I built in a previous post. We will enhance it to contain a rules service that the machine learning model takes as an input. It will use Pattern 1 above, Leverage machine learning outputs as an input into rules.

Let’s start with what we are changing in the proof of concept to support the integration of rules with machine learning. Below is a diagram that illustrates the architecture:



Architecture for example proof of concept

All components of the previous proof of concept hold true, (please see that previous blog for the details as I won’t repeat them here). The one new thing we introduced is the Java-based Rules MS. This is the rules microservice that will evaluate the output of the machine learning model probability. H20 outputs a confidence value as part of its predictions. For a transaction that the machine learning model determines is OK/Not Fraudulent, the rules service will check this confidence value. If the confidence value is less than 50%, then it will evaluate the output of some additional fraud checks, in this case name and address. If either of those failed, the rule will recommend that the transaction is Fraudulent.

Here is a sequence flow that walks through the steps:


Now let’s take a look at the Java Rules MS code to see how a drools rule would operate.

    rule “Trans OK and Prob < 0.50 and name check fail”
  when
     m : RulesData( modelProb <= 0.50, mymodelProb : modelProb)
     RulesData( status == “Transaction OK” )
     RulesData( nameCheck <= 0 )
  then
     m.setStatus(“Fraudulent Transaction from Rules, name check   
     failed”);
end
rule “Trans OK and Prob < 0.50 and address check fail”
  when
     m : RulesData( modelProb <= 0.50, mymodelProb : modelProb)
     RulesData( status == “Transaction OK” )
     RulesData( addressCheck <= 0 )
  then
     m.setStatus(“Fraudulent Transaction from Rules, address check
     failed”);
end

We can see this is using the Drools drl syntax, which is a way to write technical rules. There are two rules both checking if the transaction is OK and the machine learning output is less than 50%. The first rule also checks if a name check fails, where the second checks if an address check fails. You’ll notice in Drools there are not any else clauses. That is by design and rules fire based on  conditions you specify. Within each rule you notice a RulesData function that is checking the status of several variables. In order for Drools rules to be evaluated against data, you have to create a POJO that represents the data model. This will include the getters and setters. See example below:

    public static class RulesData {
  private int nameCheck=0, addressCheck=0;
  private String status=null;
  private double modelProb=0;
  public String getStatus() {
     return this.status;
  }
  public int getNameCheck() {
     return this.nameCheck;
  }
  public int getAddressCheck() {
     return this.addressCheck;
  }
  public double getModelProb() {
     return this.modelProb;
  }
  public void setNameCheck(int nameCheck) {
     this.nameCheck = nameCheck;
  }
  public void setAddressCheck(int addressCheck) {
     this.addressCheck = addressCheck;
  }
  public void setModelProb(double modelProb) {
     this.modelProb = modelProb;
  }
  public void setStatus(String status) {
     this.status = status;
  }
}

Let’s look at a snippet of the Java code that invokes the Drools rules, see below:

    //run drools rules
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("ksession-rules");
// go !
kSession.insert(applicant);
kSession.fireAllRules();
kSession.destroy();

This code creates a KieSession and then inserts the data we want the rules to execute against into the KieSession. FireAllRules() tells Drools to do just that, fire all rules. Then Destroy() is used for cleanup. The Java based Rules MS takes the output of the drools rules and ultimately writes it to Kafka where it can be consumed.

Summary

Rules and machine learning each have their own strengths and are even more powerful when used together. Using the right solution for the problem is key. Leverage rules when you need precision and know the logic, leverage machine learning when you want to predict something but don’t know exactly how. Both can be used in a reactive microservices architectural style that provides a more maintainable, scalable, and faster to deliver architecture.

I hope you found this blog valuable and thank you for your time!

Andrew Bonham, Senior Distinguished Engineer/Architect
Senior Distinguished Engineer with a passion in microservices, open source, cloud, reactive architectures. business process management, and rules engines.

Loss Functions

Mike's Notes

Nature recently had an interesting article about loss functions. This could be useful as a way to check Pipi.

Resources

References

  • Reference

Repository

  • Home > Ajabbi Research > Library >
  • Home > Handbook > 

Last Updated

18/05/2025

Inside the maths that drives AI

By: Michael Brooks
Nature: 03/07/2024

Loss functions provide a mathematical measure of wrongness: they tell researchers how well their artificial-intelligence (AI) algorithms are working. There are dozens of off-the-shelf functions. But choosing the wrong one, or handling it badly, can create AI systems that blatantly contradict human observations or obscure experiments’ central results. Programming libraries such as PyTorch and scikit-learn allow scientists to easily swap and trial functions. A growing number of scientists are creating their own loss functions. “If you’re in a situation where you believe that there are probably errors or problems with your data … then it’s probably a good idea to consider using a loss function that’s not so standard,” says machine-learning researcher Jonathan Wilton.

 ..." - Nature

Wikipedia

"In mathematical optimization and decision theory, a loss function or cost function (sometimes also called an error function) [1] is a function that maps an event or values of one or more variables onto a real number intuitively representing some "cost" associated with the event. An optimization problem seeks to minimize a loss function. An objective function is either a loss function or its opposite (in specific domains, variously called a reward function, a profit function, a utility function, a fitness function, etc.), in which case it is to be maximized. The loss function could include terms from several levels of the hierarchy.

In statistics, typically a loss function is used for parameter estimation, and the event in question is some function of the difference between estimated and true values for an instance of data. The concept, as old as Laplace, was reintroduced in statistics by Abraham Wald in the middle of the 20th century.[2] In the context of economics, for example, this is usually economic cost or regret. In classification, it is the penalty for an incorrect classification of an example. In actuarial science, it is used in an insurance context to model benefits paid over premiums, particularly since the works of Harald Cramér in the 1920s.[3] In optimal control, the loss is the penalty for failing to achieve a desired value. In financial risk management, the function is mapped to a monetary loss. ..." - Wikipedia

Research Repositories 101

Mike's Notes

NN Group has a series of articles on Research Repositories. 

Below are notes from an article by Maria Rosila.

Resources

References

  • Reference

Repository

  • Home > Ajabbi Research > Library >
  • Home > Handbook > 

Last Updated

18/04/2025

Research Repositories 101

By: Maria Rosila
NNGroup: 05/07/2024

Components

"Research repositories often house (or link out to) the following items:
  • Research reports capture what happened and what was learned in the research study. A research report usually includes overarching themes, detailed findings, and sometimes recommendations.
  • Research insights are the detailed findings acquired from each research study. While insights also appear in reports, saving them as their own entities makes them easier to see and address.
  • Study materials, such as research plans and screeners, allow team members to learn how research insights were gathered and easily replicate a study method.
  • Recordings, clips, and transcriptions make user data easily accessible. Summarizing and transcribing each video allows teams to search for keywords or specific information.
  • Raw notes and artifacts from research sessions might be useful for future analysis and can sometimes be easier to read or process than a full transcript or video recording. " - NNGroup
"Research repositories organize user research in a central place, making research-related documentation easy to access and consume.

As a research function scales, managing the growing research-related body of knowledge becomes a challenge. It’s common for research insights to get lost in hard-to-find reports. When this happens, research efforts are sometimes duplicated. Enter research repositories: an antidote to some of these common growing pains. ..." - NNGroup

How can on-site servers enable richer retail experiences?

Mike's Notes

This is republished from the ThoughtWorks Insights Blog.

Resources

References

  • Reference

Repository

  • Home > Ajabbi Research > Library >
  • Home > Handbook > 

Last Updated

18/05/2025

How can on-site servers enable richer retail experiences?

By: Chris Ford
ThoughtWorks Insights: 21/05/2023

Running servers in a retail store: sounds a little strange, right? However, there are multiple reasons you might want to do it. In this discussion, Thoughtworkers Chris Ford and Alessandro Salomone explore why you might want to run in-store servers — and how it can be done.

Part one: Business motivation

When people think about omnichannel retail experiences, they often start by considering in-store and digital as two distinct elements. But for a modern retailer, in-store is just another kind of digital, sometimes referred to as “phygital”.

It’s now a given that customers expect the store experience to be well-integrated into the retailer’s online presence and that they have little tolerance for services or data that are available in one touchpoint but absent in another.

Progressive retailers go further and take advantage of physical presence to address a customers’ needs contextually – someone browsing in a store requires different inspiration than the same person ordering from their couch at home.

As the relationships between different digital touchpoints become more complex, we need to develop new architectures that are resilient enough to keep stores running, powerful enough to support rich digital experiences and responsive enough to change that we can evolve them alongside the business.

Above all, we must not let the increasing digitalization of retail cause business fragility. Recent high profile cases have shown that when digital service is interrupted, it can cause massive business disruption.

My colleague Alessandro mentioned to me a system he was working on that deploys Docker containers to servers running in the stores of a large food retailer. They power point-of-sale systems that serve customer experience as well as store back office systems for processing payments and orders.

When I first heard this, it sounded like an odd mixture of technologies, as I had previously only encountered containers used in data centers or for local development environments. But when he explained the goals and trade-offs of the system architecture, I understood containerised on-site servers as a pattern that is likely to become more important as businesses bring the physical and the digital ever closer.

Digitally-powered stores

Chris Ford: Why does a store need to be integrated into a wider digital architecture in the first place?

Alessandro Salomone: Retailers have recognized the benefits of digitally-enabled stores for a long time now. One key motivator of a digital architecture is the ability to get to know your customers and to offer them targeted promotions based on their needs and tastes. This is especially true in food retailing, my client’s sector. Customers may consume products in more than one of your shops, so having a system that aggregates customer information will ensure a consistent and personalized experience wherever they shop from. 

And of course, you want your infrastructure to bridge the online and in-store shopping experiences, with the opportunity for the user to browse products, electronic receipts and benefit from personalized vouchers for the products that they are likely to love and buy.

In a post-Covid environment, retailers are actively looking to experiment and cultivate customer engagement and are particularly focused on attracting customers back to stores. Point-of-sale systems and in-store digital experiences are important investment areas to achieve this.

And on a practical level, as your business model gets more complex, you want to make sure that business processes in all your stores are supported by an infrastructure that ensures a consistent experience and implementation of such processes.

Lastly, collecting data from your stores can help you gather insights on your business in terms of fine-grained financial projections. You will have data coming from all your stores to discover the seasonality of your offering as well as to gather visibility on product waste, and appeal of your product to regional markets, just to mention a few. All this can lead to better targeted marketing and promotion design, that can help you strengthen the foundation of your business and let it grow and adapt to the ever changing landscape of the market.

Running servers in stores

CF: What reason do retailers have for installing local servers in their stores? Wouldn’t it be simpler to just talk directly to a central server running in a data center?

AS: Talking to a central server would be indeed simpler. And that's how you want everything to appear to your customers and attendants when they are shopping or operating the store — everything is connected and it all just works. You want to launch new products and promotions from a single, central point, and ensure all stores receive the same information at the right time and, as we mentioned earlier, you want to be able to identify your customers and offer them tailored services and products.

In practice, there are a few technical constraints to consider. Running a business in a store means having several classes of in-store devices that operate together to provide a seamless experience to the customer and the store personnel: security cameras, handheld devices for inventory and price labeling, scales, payment checkout tills, not to mention back office applications for stock management and solutions for walk-out checkout customer experience. 

The overriding business consideration is to ensure availability of critical services that support an uninterrupted shopping experience. The most likely disruptive event is the loss of network connectivity from the store to the central services. Crucial customer flows, like checkout and payment, must be guaranteed in this scenario. The benefits of digitization count for nothing if our technology introduces fragility that threatens business continuity.

Beyond plain checkout, how can you guarantee that the customer who just grabbed a three for two deal on roasted coffee beans can enjoy their anticipated discounts even when the internet connection goes down as the cashier is scanning them at the till? All product, price and promotion information should be readily available. Perhaps a network interruption means you can’t access promotions based on the shopper’s personal history, so how do you gracefully degrade service and still provide product level discounts? 

What if your customer is entering your walk-out store by tapping their loyalty card at the gates and there’s no, or slow, internet connection? You don’t want to make them wait: they should be swiftly welcomed by an opening gate, while the system will figure out how to identify them and eventually charge their preferred payment method as they walk out.

A store server that caches the critical business information and is able to autonomously implement business flows acts as a buffer between the store and the central services, ensuring that local store operations can go on undisturbed, and that any changes will be synchronized as soon as the connection is restored.

Another motivation for having a local server is the local management of store-specific data. The device that prints the tags to be placed on the shelves shall show the same prices and promotions that will be printed on the customer’s bill. It’s standard for retailers to vary pricing based on store considerations like location and nearby competition. But what about dynamic factors, for example whether a store has excess stock of a specific good that should be effectively depleted?

Be it a consumer electronic product imminently obsoleted by an upcoming new model, or a bottle of milk soon reaching its expiry date, the store could apply a dedicated promotion campaign targeted at reducing stock, that is going to potentially cause waste, while making customers happy. This requires the in-store personnel to be able to set up a campaign for their store from the back office application, overriding set prices and promotions, while ensuring that all the devices in store are ready to show the same information.

CF: Doesn’t this contradict the prevailing wisdom that businesses should migrate to the cloud?

AS: This architecture is not about going back to on-premise data centers. In the terminology of cloud computing, this is more like an edge computing architecture – augmenting cloud capabilities with compute situated closer to the customer. Edge computing isn’t in competition with the cloud, but a complement to it. Your favorite cloud provider almost certainly has a story around edge computing, because the advantages around resilience and latency are compelling for some use cases.

That being said, having to manage and deploy to on-premise machines and devices is more complicated than operating in a purely virtual environment. Perhaps we can talk later on about the engineering needed to pull it off.

CF: Could I think of running retail software on-site servers like installing apps on my mobile phone? A lot of the time, I happily rely on websites that are hosted in remote data centers, but for some things it’s better if the program is installed on the device in my hand.

AS: Correct, websites are fine if you don’t mind being interrupted if you lose mobile phone signal. But when you run an app locally, you get better performance and integration with the rest of your mobile experience. With an app, depending on what operations you want to do, some of them can still be performed even when you have an intermittent internet connection.

An example you may be familiar with is Google Docs. If you install the app on your mobile it lets you continue to work even when you are offline, and transparently syncs with the server when you have connectivity again.

In the same way, having servers in the store means having your business data and logic here, next to where you need them, without being dependent on something external to operate. Having smart devices communicate with a local server that orchestrates your business processes allows your stores to operate independently, while remaining aligned with the overall business implementation and its evolution dictated by the central services.

CF: Can you give me an idea of the scale of the architectures you’ve worked on? How many stores, how many services etc?

AS: In one of our projects we worked with a client supporting 40,000 devices in more than 2000 stores. Each device would be configured to receive daily business data updates and to send near real-time telemetry and analytical data to the central servers. At this scale, device failures and network interruptions happen all the time, so your system better be prepared to deal with them.

Related use cases from other industries

CF: Do you see on-site servers being used in other industries or contexts?

AS: On-site servers are a concept applicable in several other industries. This architecture brings advantages wherever there is the need for data and operations being available for highly-critical business processes or in businesses where good network connectivity is an inherent issue or cost.

One example that we have discussed with clients is hospitals. A modern medical center is a sophisticated information technology hub. It runs various software that manage sensitive clinical as well as operational data. Applications running on local servers offer a way to support these applications and also to gracefully upgrade them. Tolerance of network failure is essential as the hospital cannot stop treating patients in the case of an outage.

Another is cruise ships. The digital expectations of passengers are rising. Entertainment, schedules, menus, communications and even digital room keys are becoming an essential part of a luxury experience. On-board servers give a way to support these experiences without relying on connectivity that is often unavailable at sea.

Thank you Alessandro for relating your first-hand experience developing software for in-store servers and explaining why retail businesses are motivated to adopt this architecture.

In the next part of this series, I talk with Alessandro about the engineering challenges that come with developing such a system. Deployment, testing and observability require some different approaches relative to systems hosted in data centers.

By Chris Ford

Published: May 21, 2024 

Part two: Engineering

In the first part of this series, Alessandro Salomone described why retailers turn to running servers in their stores. Local servers provide a platform for richer digital experiences for customers, more sophisticated back office processes around data pricing and payment and above all enable resiliency in the case of network failure.

In this follow-up piece, we dive into the engineering you need to do it well. For example, we discuss challenges like testing and deployment and find out why containerization makes this all easier and more robust.

Data synchronization

Chris Ford: Doesn’t a local server introduce problems of data synchronization with the central server? How do you handle that?

Alessandro Salomone: Yes, and no. A setup in which a local server is present helps reduce the volume of data exchanged with the central servers, avoiding each and every device communicating with the servers. It also makes operations faster and more reliable, because the devices benefit from data cached in the local server, on a local network that is more stable and faster than the internet. 

The presence of a local server increases the complexity of the architecture, which has to be designed to ensure eventual synchronization of the information in store and on the central server. Temporary central server unavailability or unreachability, due to heavy loads or connection issues, can cause temporary desynchronization between the two servers.

For this, we designed the servers to communicate using event queues in both directions, allowing the local server to pull events from the central server and vice versa. Events can be anything from the broadcasting of a product update, the availability of a new promotion campaign, a device reporting a failure or a client checking out. Queues allow the servers to catch up on missed updates caused by a temporary disconnection by replaying all the missed events.

Another challenge worth mentioning is sizing on-premise infrastructure. Load is highly unpredictable in stores. The amount of footfall and therefore digital traffic varies a lot between stores and changes at different times of the year. It’s a good idea to make in-store infrastructure as horizontally scalable as possible so that you can add more capacity where you need it. You don’t want to rely on single large machines that will take the whole store down if they are overloaded, while servers in other stores are underutilized.

Testing and deployment

CF: How do you deploy updates to these local servers?

AS: Local servers were running their logic in containerized microservices. This would allow the development teams to publish new versions of the microservices to a central container registry and wait for the local servers to discover and pull the new container images.

The local servers would have their container orchestrator to check for images on a frequent schedule, to ensure new features and bug fixes could be rapidly deployed to all stores.

When you design your container orchestration, be sure to consider the resource constraints of your in-store hardware. Kubernetes and its ecosystem of tools like Argo CD are powerful and might do what you need, but they are also primarily designed for data centers. You have to find a balance between achieving a lightweight solution and avoiding the temptation to roll your own infrastructure orchestration.

CF: How would you test such a setup?

AS: The containerisation makes testing this setup a lot easier than if we were installing applications directly onto local devices. Testing can be done by replicating the containers and their connectivity on a virtual machine and running manual or automated tests, for example using a continuous integration pipeline. In our case we needed an extra step, which was to virtualise the in-store devices that the microservices solution talks to. 

We decided to design the microservices architecture to ensure that every in-store device would have a corresponding containerised microservice that would abstract the device’s data and control interfaces. With a test double for each device microservice, it is possible to replace the original microservice in a test setup. The test containers virtualizing the devices would feature a control port to ensure device data and behavior could be simulated, so as to implement all the required test scenarios, and in fact drive the development.

CF: When deploying to a cluster of servers in a data center, you might test the release with a small group of servers. Is there an equivalent for store servers?

AS: Definitely — in our experience, we built a thin layer on top of our container orchestrator in order to implement a pilot and canary release management. A specific store, or a selected set of stores could be identified as a deployment group for “beta” releases of new software. This would happen regularly and automatically so that all the new features introduced by the new software version would be tested in a controlled environment, and end-to-end customer or store attendant feedback would be collected before releasing the version globally. 

Unpredictable environments

CF: A data center is a very controlled environment. A store is less so. What does support look like when you have servers running out there in the world?

AS: To start with, a VPN LAN is a must for security. Incoming connections should be blocked and outgoing connections should be allowed based on an allow-list. This helps to protect your in-store systems from external threats.

Proper, dedicated support channels should be available to store attendants and managers to quickly communicate issues and get them solved. For this reason a first-level line of support would be available to ensure that any store issue would promptly be recorded and redirected to the correct department and, eventually, development team. This requires the development teams to build support guides that help the first-level support line to address the most easy-to-solve issues, or, in case of more complex or unknown issues, to know what information on the user’s experience and actions to collect and pass to the team, that would speed up its investigation and fix.

A ticketing system would be used to record the user’s issue and automatically reach the development team most likely able to contribute to the solution, by ringing the phone and sending an email to the team member on the roster: just a few minutes and the developer would be in conditions to get in contact with the store personnel.

This is where observability becomes essential: support is part of the product development process, and it has to be thought through from the very beginning. Building and running a system that can collect health metrics on the microservices running on the local server, and possibly from the connected devices, is an effective way to be able to observe what is happening in store and quickly spot issues. Also business metrics on the user flows are essential to understand where users (be it customers or attendants) are getting stuck or are experiencing problems.

With appropriate observability tools, like logs, audits and dashboards, the development team can relate the actions of the people in store with the timestamped information coming from the in-store telemetry, thus gaining that visibility that would allow them to spot the lamented issue. Here it is important to ensure the data is collected and presented in a way that can easily tell the story of what has happened.

In urgent or complex cases, it would become more practical for the development team to directly call back the store and ask them to re-enact the situation, in order to reproduce the error. Thanks to near-real-time telemetry, the developers would be able to see what was happening in store and in the software running there on the local server, and promptly release an emergency fix that would be distributed to all the stores within the hour.

High-traffic periods

CF: I recently spoke to our colleague Glauco about building retail systems to survive Black Friday and Cyber Week. How does this architecture stand up to demand in those busy periods?

AS: A nice thing about this architecture is that store systems are designed to run independently, so Cyber Week and load from elsewhere isn’t really a problem. It’s still very important that everything stays up though!

It is in these periods of the year when the advantages of this distributed architecture are especially visible. One of our customers stated that more than 50% of their yearly revenue would come from Christmas shopping: a period in which the stores need to be fully operational at their maximum capacity, without disruptions.

And of course, information like price changes and promotion campaigns for these weeks need to be readily available before the customers flood in the stores. That’s where the idea came to ensure such data to be delivered in the stores even a week before the new schemes would be effective. All information, accompanied by a proper start and end date, would be readily available and usable by the store server and all the other in-store devices, and active only in the expected time period, even if connection to the central service was a bottleneck.

At the end, the central server acts as a business orchestrator, distributing information and stating the expected behavior, as well as a collector for the observability of the business for support purposes and business intelligence insights. All this while the heavy load is handled seamlessly at the local level.

Thank you Alessandro for your insights running business-critical services via in-store deployments.

These kinds of architectures support next generation in-store experiences, but they also give rise to distributed systems challenges not found in traditional data center based systems.

At Thoughtworks we’ve observed local deployments supporting rich in-store digital functionality as part of a movement back to on-premise, not as an alternative to cloud computing, but as a complement to it. We predict that as in-person and online digital experiences become ever more closely integrated, this trend will continue.

Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.

eRwin Data Modeller

Mike's Notes

In the early 2000s, I used Erwin Data Modeller, E/R Studio, and Case Studio 2 to create large data models for Pipi with hundreds of tables or entities.

Resources

References

  • Reference

Repository

  • Home > Ajabbi Research > Library >
  • Home > Handbook > 

Last Updated

18/05/2025

eRwin Data Modeller

By: 
Wikipedia: 08/08/2024

Mike is the inventor and architect of Pipi and the founder of Ajabbi.

Wikipedia

"At its core, erwin has a computer-aided software engineering tool (or CASE tool). Users can utilize erwin Data Modeler as a way to take conceptual data model and create a logical data model that is not dependent on a specific database technology. This schematic model can be used to create the physical data model. Users can then forward engineer the data definition language required to instantiate the schema for a range of database-management systems.The software includes features to graphically modify the model, including dialog boxes for specifying the number of entity–relationships, database constraints, indexes, and data uniqueness. erwin supports three data modeling languages: IDEF1X,] a variant of information technology engineering developed by James Martin, and a form of dimensional modeling notation.
The software also allows users to generate data models by reverse-engineering pre-existing databases that are based on several different formats. Another included feature is erwin’s ability to create reusable design standards: “including naming standards, data type standards, model templates and more.” The software includes several features for modifying how the data model is displayed, including options for several colors, fonts, diagrams, subject areas and layouts.
erwin’s Complete Compare feature allows the user to compare two versions of a model, displays differences, and allows for merging and updates in either direction.As of March 2016, the software bundle also includes its own Report Designer. The erwin DM 2018 update included Netezza, MySQL 8.x, PostgreSQL 10.4, and Hive; model counts reports; and PII support. The 2019 update included DB2 z/OS v12, SQL Server 2017, Teradata v16.20, and PostgreSQL 11.2, in addition to reporting enhancements like user-defined properties and filters." - Wikipedia