Skip to content
Data-Driven Programming — Explained with Examples

Data-Driven Programming — Explained with Examples

DodaTech Updated Jun 15, 2026 2 min read

Data-driven programming is a paradigm where the logic of a program is driven by external data structures — tables, configuration files, rule sets — rather than hard-coded conditional logic. The same code operates on different data to produce different behavior.

In data-driven programming, you separate the mechanics (the code that interprets data) from the policy (the data itself). For example, a table-driven state machine, a spreadsheet where formulas define behavior, or a business rules engine. This approach makes programs more flexible and easier to modify without changing code. It is closely related to Declarative vs Imperative declarative programming and Functional Programming.

Real-world analogy. Data-driven programming is like a universal remote that accepts a configuration file (data) mapping buttons to actions. The remote’s internal code stays the same; you just change the data to support a different TV brand. If you hardcoded Samsung logic, you’d need a new remote for LG. Data-driven: one remote, different configs.

Example (Table-driven pricing):

# Data (configurable table)
PRICING_RULES = {
    "basic": {"monthly": 10, "annual": 100, "features": ["1 user"]},
    "pro":   {"monthly": 29, "annual": 290, "features": ["5 users", "API"]},
    "enterprise": {"monthly": 99, "annual": 990, "features": ["Unlimited"]},
}

# Logic (same code, different data)
def calculate_price(tier, billing):
    return PRICING_RULES[tier][billing]

Related terms: Declarative vs Imperative, Functional Programming, Procedural Programming, Event-Driven Programming, Configuration Management

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro