Software Engineering & Programming Tools · 2 hours · online
The session compares the mechanisms that let one platform accommodate differences across customers and markets without spreading conditionals through the code, multiplying special operations or raising the risk to critical services. The lab applies them to three needs of Tradeline, a fictional B2B marketplace.
Guiding question: how can we accommodate differences across customers and markets without scattering variation throughout the code, without multiplying special operations and without increasing risk to the critical services of the ecosystem?
Participants classify variations by type and binding time, compare mechanisms by coupling, testability, isolation, cost and blast radius, encapsulate tenant and market context in platform primitives and use AI agents for impact analysis under architectural constraints.
Architecture Option Sketch: for each of the three lab needs, two options with explicit testing and operating costs and the effect of a failure on the end user and on the critical services.
Every demand that reaches the platform ends in one of seven options. This session deals with the technical mechanisms behind the options that keep the demand inside the product.
| Option | When it tends to be appropriate |
|---|---|
| Reject | Low strategic fit, or cost and complexity that cannot be justified |
| Defer and learn | Evidence is insufficient and uncertainty must be reduced before deciding |
| Use existing capability | The need is met by discovery, enablement or process, without a new feature |
| Configure or entitle | Anticipated variation, or an offering differentiated by segment or tier |
| Generalize into core | A recurring need that justifies a global abstraction |
| Extend or integrate | A valid need that is better met outside the core, through API, adapter, event or plugin |
| Bespoke exception | Last resort, with sponsor, total cost, lifecycle, observability and an exit plan |
Software product line engineering separates what is common to every customer from what is allowed to differ, and decides in advance where and when each difference is resolved.
Capabilities and rules that remain consistent everywhere and evolve as part of the common product. At Tradeline, order issuing, the order state machine and the pricing pipeline belong to the core.
A point in the architecture where the product admits alternatives, such as the tax applied to an order. The variation point is designed once and has a known contract.
The concrete behaviour selected for a market, a tier or a customer, such as IVA at 19% in Colombia. Variants are added without changing the code of the core.
At build, at deploy or at runtime. Later binding gives flexibility per tenant and moves cost to testing and operations, because more combinations exist in production.
Pohl, Böckle & van der Linden (2005); Apel et al. (2013)
Classifying a demand before choosing a mechanism avoids treating every difference in the same way. The type indicates who owns the rule and how long it is expected to last.
| Type | What varies | Example at Tradeline | Typical binding |
|---|---|---|---|
| Domain | How the business works in a segment or service model | Indirect model: the distributor, and not the manufacturer, confirms stock | Runtime, per tenant |
| Commercial | What a customer bought or negotiated | Premium distributors get approval workflows | Runtime, per entitlement |
| Regulatory | What the law of a market requires | Tax rules, fiscal identifiers, electronic invoices | Runtime, per market, with legal start date |
| Release | Whether a new behaviour is exposed yet | New checkout shown to 5% of retailers | Runtime, temporary |
| Infrastructure | Where and how the software runs | Data residency for one market, dedicated capacity | Deploy |
No mechanism is better in general. Each one moves the cost of variation to a different place, and the choice depends on the type of variation and on how much the variants must be isolated from each other.
| Mechanism | Coupling | Testability | Isolation | Cost | Blast radius |
|---|---|---|---|---|---|
| Configuration | Low, if the parameter is anticipated | Good per value; combinations grow | None between tenants | Low to build | Wrong value affects the tenant or market |
| Metadata | Low; behaviour described as data | Needs tests of the interpreter and of the data | Logical | High upfront, low per variant | An interpreter bug reaches everyone |
| Entitlement | Low; checks a contract | Good; finite set of plans | Logical | Moderate; needs a billing link | Limited to the plan |
| Feature flag | Grows with every flag left in the code | Doubles paths per flag | None | Low now, debt later | Small if the cohort is small |
| Extension point | Defined by the contract | Contract tests per extension | Depends on where the extension runs | Moderate | Contained if extensions are sandboxed |
| Adapter | Confined to the integration edge | Contract tests against each partner | Good at the edge | One per partner or protocol | The integrated partner |
| Deployment stamp | None in code | Same code, more environments | Physical | Highest to operate | One stamp |
The tenancy model decides how much of the infrastructure customers share. It determines the cost to serve, the isolation of failures and the noise one tenant can cause to the others.
All tenants run on the same services and databases, separated by a tenant identifier. Lowest cost to serve and simplest to evolve, with the risk of noisy neighbours and a blast radius that covers everyone.
Each tenant, or each market, gets its own stack. Strong isolation and easy compliance with residency rules, with higher operating cost and the temptation to let each silo diverge in code.
Some layers are pooled and others are siloed, for example a shared application tier with a dedicated database for a large distributor. Most real platforms end up here.
Golding (2024); Microsoft (2024); Weissman & Bobrowski (2009)
A toggle is classified by why it exists and how long it should live. Using release flags as permanent commercial differentiation is the most common confusion in this topic.
| Toggle | Purpose | Expected life | Who changes it |
|---|---|---|---|
| Release | Ship incomplete code safely and expose it progressively | Days to weeks, then removed | Engineering |
| Experiment | Compare variants for a decision | Duration of the experiment | Product and data |
| Operations | Degrade or switch off a feature under load or failure | Long-lived, rarely changed | SRE and on-call |
| Permission | Give access to a capability for some users | Long-lived | Product and support |
| Entitlement | Express what a customer bought or negotiated | As long as the contract | Commercial, through billing |
Hodgson (2017)
A platform team offers a library or service that resolves tenant and market context once. Application code asks the primitive for a policy and no longer knows which country it is serving.
def compute_tax(order):
if order.country == "BR":
tax = order.subtotal * 0.18
elif order.country == "MX":
tax = order.subtotal * 0.16
elif order.country == "CO":
tax = order.subtotal * 0.19
...
if order.country == "BR" and \
order.customer.customer_id == "DIST-0042":
st = order.subtotal * overridedef compute_tax(order, ctx: TenantContext):
policy = tax_policies.resolve(
market=ctx.market,
delivery_region=order.delivery_region,
tier=ctx.tier,
at=order.issued_at,
)
return policy.apply(order)
# policies are versioned data with an owner,
# a start date and tests per policyFournier & Nowland (2024); Skelton & Pais (2019)
Coding agents speed up the search for every occurrence of a variation and the first draft of the refactoring. The speed is only useful when the output is verified against the repository and the architecture.
Ask the agent to find every place where the market decides behaviour, in all layers, including SQL and configuration.
Require file, line and reason for each occurrence, and the list of what was searched.
Confirm each line by hand, look for spellings the agent did not try and remove false positives.
State the architecture rules in the prompt: public contracts that cannot change, where the primitive lives.
Review the diff as code from a new colleague: tests of both paths, no secrets, no unsafe input handling.
DORA (2025); OWASP (2024)
The facilitator first presents a case from BEES engineering, then repeats the reasoning on the Tradeline sample repository with a coding agent.
Presented live. Observe three things: which API contracts could not change because of the systems integrated with them, how latency in one service cascades to the user, and how far a failure in catalog and pricing would reach. Then observe why the chosen change stayed close to the user layer.
On tradeline-orders-sample, the agent maps every country conditional of the tax rule in the UI, the service and SQL. The facilitator checks the map against the repository, shows what it missed, and asks for the extraction into a configurable policy under stated constraints.
Tradeline is a fictional global B2B ordering marketplace operating in Brazil, Mexico, Colombia, South Africa and the Dominican Republic. Its tax rule already lives as country conditionals in three layers.
Colombia exempts orders delivered to two departments from IVA, from a legal start date. Mexico may follow with border zones. The rule depends on the delivery address.
About 120 premium accounts want orders above their own threshold to wait for a purchasing manager. Some want thresholds per region, one wants two approvers.
The largest distributor in South Africa wants orders pushed in real time and stock pulled every 15 minutes from a SOAP ERP that changes twice a year. Others may ask next.
Groups of five or six in breakout rooms, 40 minutes. Roles rotate every workshop.
Type of variation and binding time of each need.
Effects on code, deployment, testing, operations and cost, and the missing information.
Map every occurrence of the tax conditional and propose the extraction into a policy. Verify the map by hand.
For the preferred option, what happens to the retailer and to critical services if it fails.
Check that every need has two options with explicit testing and operating costs.
Conducts the discussion and keeps the group on the three needs.
Writes the Architecture Option Sketch in the template.
Announces each step and protects the last five minutes.
Challenges assumptions and asks what the option costs to test and operate.
One block per need. Write ranges or "unknown" when the group does not know, and record what it would need to find out.
| Field | Option A | Option B |
|---|---|---|
| Type of variation and binding time | Domain, commercial, regulatory, release or infrastructure; build, deploy or runtime, and why | |
| Mechanism and where it is encapsulated | … | … |
| Effect on code and deployment | … | … |
| Testing cost | … | … |
| Operating cost, isolation and blast radius | … | … |
| Missing information | What the group would ask before deciding | |
| Preferred option and failure effect | Effect on the retailer and on order issuing, catalog and pricing if it fails | |
| What would change our mind | The fact that would reverse the provisional direction | |
Both classes run the same lab. The emphasis changes with the profile of the participants.
More time for the assisted refactoring: the group implements the tax policy primitive in the sample repository and keeps the existing tests passing.
Architects lead the comparison of mechanisms and tenancy models; QA and SRE assess the testability and operability of each option.
If Cursor or the repository is not accessible, the group verifies impact-map-pregenerated.md against the code listings in the kit.
Fifteen minutes across groups. The comparison matters more than any single answer.
Which groups chose the same mechanism for the same need, and did they justify it by the same constraint? What is the testing cost of the preferred option for need 1, measured in combinations of market, region and date? Which occurrences did the agent miss, and why was the search unable to find them? Where did a group use a feature flag for something that will last as long as a contract?
Classify the variation before choosing the mechanism. Resolve tenant and market context in one place. Give every exception an owner, a cost and an exit path. Treat an impact map produced by an agent as a hypothesis to verify.
Two groups present their options for the regional tax rule; the others mark agreement and disagreement.
Groups compare the occurrences they confirmed, removed and added to the agent's impact map.
One flag-versus-entitlement decision and one adapter decision, with their testing costs.
There is no grade. The rubric tells each group where its sketch stands and what to strengthen in the post-work.
| Criterion | Proficient | Developing |
|---|---|---|
| Classification | Type and binding time of each variation correctly identified | All variations treated as the same |
| Mechanism comparison | Options evaluated by coupling, testing, operations, cost and effect on critical services and end users | A single solution chosen by preference |
| Use of AI | Impact map verified and extraction consistent with the architecture | Agent output accepted without verification |
Each group reads its own sketch against the three criteria during the debrief and marks one criterion where it is still developing. That criterion becomes the focus of the post-work.
A classification for each need, two options with the testing and operating cost written down, and an impact map with at least one occurrence confirmed, added or removed by hand.
The post-work applies the sketch to a real variation of the participant's own system, without confidential names.
Demand type, options, trade-offs, provisional direction and what would change your mind. Bring it to Project Development.
The next session starts from what happens when the options of today are not followed: conditionals in every layer, columns created for one customer and flags that never leave the code.
Designing for Managed Variability · Prof. Afonso
By the end of the session, participants should be able to classify variations across customers and markets by type and binding time, compare configuration, metadata, entitlement, feature flag, extension point, adapter and deployment stamp by coupling, testability, isolation, cost and blast radius, propose the encapsulation of tenant and market context in platform primitives, and verify an impact map produced by an AI coding agent before accepting a refactoring.
Two-hour online workshop following the standard structure of the program. A retrieval poll on the decision options of the Kick Off opens the session, a thirty-minute briefing presents planned variability, multi-tenancy, flags and entitlements, platform primitives and AI for large-scale changes, and the facilitator works through a real case from BEES engineering and a live demo in Cursor on the sample repository of Tradeline, a fictional B2B marketplace. Groups of five or six with rotating roles then write an Architecture Option Sketch for three needs and verify the agent's impact map, followed by a debrief across groups and the post-work.