0% found this document useful (0 votes)
8 views20 pages

Understanding Data Flow Architecture

Data Flow Architecture (DFA) is a software architecture style focused on the movement and transformation of data through processing components, emphasizing one-way data flow along defined paths. It includes various architectures like Batch Sequential, Pipe-and-Filter, Blackboard, Rule-Based, and Implicit Invocation, each with unique characteristics and use cases. Key features of DFA include loose coupling of components, ease of modification, and the ability to process data in parallel or sequentially depending on the architecture type.

Uploaded by

sherifabdulmaged
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views20 pages

Understanding Data Flow Architecture

Data Flow Architecture (DFA) is a software architecture style focused on the movement and transformation of data through processing components, emphasizing one-way data flow along defined paths. It includes various architectures like Batch Sequential, Pipe-and-Filter, Blackboard, Rule-Based, and Implicit Invocation, each with unique characteristics and use cases. Key features of DFA include loose coupling of components, ease of modification, and the ability to process data in parallel or sequentially depending on the architecture type.

Uploaded by

sherifabdulmaged
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Sure! Let’s break down Data Flow Architecture (DFA) in a way that’s clear and exam-friendly.

I’ll do it both with analogies and then in a formal explanation, just like we did for software
architecture PDFs.

1. Data Flow Architecture (with analogy)


Imagine a factory:

●​ Raw materials (data) enter the factory.


●​ Different machines (processes/components) process these materials.
●​ Conveyer belts (data paths/pipes) carry materials between machines.
●​ At the end, the finished products (output data) leave the factory.

Now, apply this analogy to a software system:

●​ Data Sources = raw materials entering the factory (user input, sensors, external APIs).
●​ Processes = machines that transform data (e.g., calculations, formatting, aggregations).
●​ Data Stores = warehouses where data can be kept temporarily or long-term (databases,
files).
●​ Data Sinks = final destinations for processed data (UI, reports, other systems).
●​ Data Flows = conveyer belts connecting sources, processes, and sinks.

Key points:

●​ Data always moves in one direction along defined paths.


●​ Components are loosely coupled: each process only knows about its inputs and
outputs, not the internal workings of other processes.
●​ You can add, remove, or modify processes without breaking the entire system.

2. Data Flow Architecture (formal explanation)


Definition:​
Data Flow Architecture is a software architecture style where the primary concern is the
movement and transformation of data through a series of processing components. It
emphasizes what happens to data rather than control flow.

Core Elements:

1.​ Processes (Transformations):


○​ Independent computational units that receive input data, transform it, and
produce output data.
○​ Example: parsing a CSV, computing a sum, filtering records.
2.​ Data Stores (Optional):
○​ Places to temporarily or persistently hold data.
○​ Can be queues, buffers, databases, or files.
3.​ Data Flows (Pipes/Streams):
○​ The channels along which data moves from one process to another.
○​ Can be synchronous (blocking) or asynchronous (non-blocking).
4.​ Sources and Sinks:
○​ Source: origin of data (user input, sensors, external systems).
○​ Sink: endpoint where processed data is consumed (UI, reports, external
systems).

Characteristics:

●​ One-way flow: Data typically flows in a directed path from sources → processes →
sinks.
●​ Stateless processes: Processes usually don’t store internal state between data items
(state is optional and externalized in stores).
●​ Parallelism: Independent processes can operate simultaneously, improving
performance.
●​ Ease of modification: You can add or remove processes or change data flows without
affecting unrelated components.

Common Examples:

●​ ETL pipelines in data engineering (Extract → Transform → Load).


●​ Signal processing systems (audio/video streams).
●​ Unix pipes (e.g., cat file | grep "x" | sort).
●​ Streaming architectures (Kafka, Flink, Spark Streaming).

Diagram representation
Data Source ---> [Process 1] ---> [Process 2] ---> Data Sink
|
v
[Data Store]

●​ Arrows = data flow


●​ Boxes = processing components
●​ Optional storage can buffer intermediate results
Perfect! Let’s break down the types of Data Flow Architectures—Batch Sequential and
Pipe-and-Filter—in the same two ways: analogy and formal explanation, like before.

1. Batch Sequential Architecture


Analogy:

Think of a bakery:

1.​ You collect a batch of raw ingredients for multiple cakes (flour, sugar, eggs).
2.​ Step 1: Mix all ingredients for the entire batch.
3.​ Step 2: Bake all cakes in the oven at once.
4.​ Step 3: Decorate all cakes in one go.
5.​ Then send them to the store.
●​ Each step waits for the entire batch to finish before the next step begins.
●​ Data is processed in chunks, not continuously.

Formal Definition:

Batch Sequential Architecture is a style where data is collected into batches and then
processed sequentially through a series of steps. Each step:

●​ Processes the entire batch.


●​ Writes the output to a storage or buffer for the next step.

Characteristics:

●​ Sequential processing: One stage completes before the next starts.


●​ Batch-oriented: Data is processed in groups.
●​ Intermediate storage: Each step may write to a file or database.
●​ Simple control flow: Easy to understand and maintain.

Examples:

●​ Payroll systems: calculate all salaries at the end of the month.


●​ ETL batch pipelines: transform and load data daily.

Diagram:

[Batch Source] ---> [Process 1] ---> [Process 2] ---> [Batch Sink]


2. Pipe-and-Filter Architecture
Analogy:

Imagine a water filtration system:

1.​ Water enters the first filter → removes large particles.


2.​ Passes through the second filter → removes smaller particles.
3.​ Third filter → adds minerals or disinfects.
4.​ Clean water comes out.
●​ Each filter (process) works independently.
●​ Water flows continuously, not in batches.
●​ Filters can often run in parallel, improving speed.

Formal Definition:

Pipe-and-Filter Architecture is a style where data flows continuously through a series of


processing components (filters) connected by pipes:

●​ Filter: A stateless component that reads input, transforms it, writes output.
●​ Pipe: A connector that transports data from one filter to the next.

Characteristics:

●​ Continuous data flow: No need to wait for entire batch.


●​ Independent filters: Each filter only knows its input/output.
●​ Parallelism: Filters can operate simultaneously.
●​ Flexible composition: You can add/remove filters easily.

Examples:

●​ Unix command pipelines: cat file | grep "x" | sort.


●​ Streaming data: Kafka → Flink → Elasticsearch.
●​ Image processing pipelines.

Diagram:

Data Source ---> [Filter 1] ---> [Filter 2] ---> [Filter 3] ---> Data Sink
Key Differences: Batch Sequential vs Pipe-and-Filter

Feature Batch Sequential Pipe-and-Filter

Data Processing Mode In batches Continuous/streaming

Step Dependency Each step waits Steps can work independently

Storage Between Steps Required (buffer/files) Optional

Parallelism Limited High

Use Case Payroll, ETL batch Streaming, signal processing

1. Blackboard Architecture (with analogy)


Imagine a classroom with a blackboard:

1.​ A problem is written on the blackboard.


2.​ Multiple students (experts) work on the problem.
○​ Each student can read the current state of the problem on the blackboard.
○​ Each student can write updates or suggestions back to the blackboard.
3.​ Students don’t communicate directly with each other. They coordinate through the
blackboard.
4.​ The process continues until a solution emerges on the blackboard.

Key idea: shared workspace = blackboard, specialized experts = components, central


control = control mechanism.
2. Blackboard Architecture (formal explanation)
Definition:​
Blackboard Architecture is a software architecture style where:

●​ A shared data structure (the blackboard) contains the evolving solution to a problem.
●​ Multiple independent components (knowledge sources or experts) monitor the
blackboard and contribute when they can add value.
●​ A control component decides which expert should act next based on the state of the
blackboard.

Core Elements:

1.​ Blackboard:
○​ Central repository storing partial solutions, intermediate data, and final
results.
○​ All components can read from and write to it.
2.​ Knowledge Sources (Experts):
○​ Independent modules that know how to solve specific aspects of the problem.
○​ Each decides when and how to act based on the current blackboard state.
3.​ Control Component:
○​ Oversees coordination and sequencing of knowledge sources.
○​ Chooses which expert acts next (can be priority-based, opportunistic, or
rule-based).

Characteristics

●​ Highly flexible: Experts can be added or removed easily.


●​ Opportunistic problem solving: Experts contribute only when their knowledge is
applicable.
●​ Centralized communication: Blackboard is the only medium for coordination.
●​ Good for complex, ill-structured problems: Often used in AI, speech recognition, and
design systems.

Example Applications

●​ Speech recognition systems (different modules detect phonemes, words, grammar, etc.).
●​ Design systems (e.g., integrated circuit layout, where multiple heuristics contribute).
●​ AI problem solvers (like knowledge-based expert systems).
Sure! Let’s go through Rule-Based Architecture, again using analogy and formal
explanation.

1. Rule-Based Architecture (with analogy)


Imagine a traffic control system:

1.​ There are sensors and cameras detecting traffic conditions.


2.​ The system has a set of rules, like:
○​ “If a car is waiting at a red light for more than 2 minutes, extend green light by 30
seconds.”
○​ “If traffic density > 80% on road A, divert cars to road B.”
3.​ The system checks each rule against the current state and executes the applicable
actions.
4.​ Rules are independent—each rule fires when its conditions are met.

Key idea: decisions are driven by rules applied to data, not by fixed sequences or flows.

2. Rule-Based Architecture (formal explanation)


Definition:​
Rule-Based Architecture is a style where system behavior is determined by a set of
conditional rules applied to a knowledge base or fact base. The system continuously:

1.​ Evaluates rules based on the current state.


2.​ Fires applicable rules (executes actions).
3.​ Updates the state or knowledge base.

Core Elements:

1.​ Knowledge Base / Fact Base:


○​ Stores facts about the current state of the system.
○​ Facts are simple statements or data items (e.g., temperature = 30°C, user
is logged in).
2.​ Rule Base:

Contains if-then rules:​


IF <condition> THEN <action>

○​
○​ Example: IF stock < 10 THEN reorder item.
3.​ Inference Engine:
○​ Evaluates rules against the facts.
○​ Determines which rules fire and in what order.
○​ Can be forward chaining (data-driven) or backward chaining (goal-driven).

Characteristics

●​ Declarative style: You define rules, not procedural steps.


●​ Flexible and extensible: You can add or modify rules without changing the whole
system.
●​ Opportunistic execution: Rules fire only when conditions match.
●​ Common in AI and expert systems.

Example Applications

●​ Expert systems (medical diagnosis: IF symptom = fever AND cough THEN


possible flu).
●​ Business rule engines (pricing, discounts, approvals).
●​ Automated decision-making (robot control, home automation).

Comparison to Blackboard

Feature Blackboard Rule-Based

Control Central control module Inference engine

Component interaction Experts via blackboard Rules operate on facts

Use case Complex problem solving Decision-making, expert systems


Data flow Opportunistic updates Condition-driven firing

Flexibility High High

Absolutely! Let’s go through Implicit Invocation Architecture and its types in the same style:
analogy + formal explanation, so it’s easy to grasp and exam-friendly.

1. Implicit Invocation Architecture (with analogy)


Think of a smart home system:

1.​ You don’t tell each device exactly when to act.


2.​ Instead, devices announce events to a shared system:
○​ “Motion detected in living room.”
○​ “Temperature dropped below 20°C.”
3.​ Other devices listening for relevant events automatically respond:
○​ Turn on lights.
○​ Start the heater.
4.​ Devices don’t directly call each other—they react implicitly to events.

Key idea: components don’t call each other directly. They register interest in events, and the
system notifies them when relevant events occur.

2. Implicit Invocation Architecture (formal explanation)


Definition:​
Implicit Invocation is a style where components interact by broadcasting and handling
events, rather than invoking each other directly.

Core Elements:

1.​ Event Source (Publisher):


○​ Generates or broadcasts events when something happens.
○​ Doesn’t know which components will handle them.
2.​ Event Listeners (Subscribers / Handlers):
○​ Components that register interest in specific event types.
○​ Automatically invoked when the event occurs.
3.​ Event Dispatcher / Event Bus:
○​ Middleware that routes events from sources to all registered listeners.

Characteristics:

●​ Loose coupling: Components don’t depend on each other directly.


●​ Dynamic: Listeners can be added or removed at runtime.
●​ Reactive: System reacts to events rather than following a strict sequence.
●​ Scalable: Easy to add more event sources or listeners.

3. Types of Implicit Invocation


a) Event-Based

●​ Components register interest in events.


●​ When an event occurs, the dispatcher invokes all interested components.
●​ Direct handling: Event source doesn’t know who will respond.

Example:

●​ A GUI button click event:


○​ Button emits “clicked” event.
○​ Multiple listeners (e.g., log handler, UI updater) respond automatically.

b) Publish–Subscribe (Pub-Sub)

●​ A more formalized version of event-based.


●​ Components are either:
1.​ Publishers: generate events but don’t know subscribers.
2.​ Subscribers: register interest in event types/topics.
●​ Event broker / message bus manages the routing of events from publishers to
subscribers.
●​ Often used in distributed systems, message queues, and real-time pipelines.

Example:

●​ Stock market system:


○​ Publisher sends stock price updates.
○​ Subscribers receive updates for stocks they care about (different users,
dashboards, alerts).

Diagram of Pub-Sub:

+-----------+ +----------------+
| Publisher | ----> | Event Broker |
+-----------+ +----------------+
|
----------------+----------------
| | |
+----------+ +----------+ +----------+
| Subscriber| | Subscriber| | Subscriber|
+----------+ +----------+ +----------+

Comparison: Event-Based vs Pub-Sub


Feature Event-Based Publish–Subscribe

Coupling Loose Very loose (via broker)

Components aware of others No No

Dispatcher Simple Event broker / message bus

Use case GUI, local apps Distributed systems, messaging

Summary in one line:

Implicit invocation = broadcast events → listeners react automatically​


Event-based = local events, direct dispatcher​
Pub-Sub = formalized, scalable, brokered events
Perfect, let’s do Interpreter Style the same structured way: analogy → formal explanation →
examples, with special focus on Interpreter systems and Mobile code.

1. Interpreter Style (with analogy)


Imagine a human translator:

●​ Someone speaks a foreign language sentence by sentence.


●​ The translator reads each sentence, understands it using grammar rules, then
executes the meaning immediately.
●​ There is no full compilation beforehand—everything is handled step by step at
runtime.

Now map this to software:

●​ The program/script is the foreign language.


●​ The interpreter engine is the translator.
●​ The grammar + rules define how each instruction should be understood.
●​ The program is executed directly as it is interpreted, not precompiled.

👉
Key idea:​
The system interprets instructions at runtime, based on a defined language and
execution rules.

2. Interpreter Style (formal explanation)


Definition

Interpreter Architecture Style is a style in which:

●​ The system defines a language or instruction set.


●​ An interpreter component reads, analyzes, and executes instructions at runtime.
●​ Program behavior is determined by interpreting expressions, not by executing
compiled machine code.

Core Components
1.​ Language / Grammar
○​ Defines valid syntax and semantics.
○​ Examples: commands, expressions, rules.
2.​ Parser
○​ Reads the input program or script.
○​ Converts it into an internal representation (AST, tokens, instructions).
3.​ Interpreter Engine
○​ Traverses the parsed representation.
○​ Executes instructions one by one.
4.​ Execution Context
○​ Holds runtime state (variables, stack, environment).

Characteristics

●​ Flexibility: Easy to change or extend the language.


●​ Dynamic behavior: Programs can be modified or loaded at runtime.
●​ Slower execution: Compared to compiled code.
●​ Clear separation: Language definition vs execution logic.

General Diagram
[ Program / Script ]
|
v
[ Parser ]
|
v
[ Interpreter Engine ]
|
v
[ Execution Environment ]

3. Example 1: Interpreter (Classic Example)


What it is

A system that directly executes a domain-specific language (DSL) or scripting language.


Examples

●​ Python interpreter
●​ JavaScript engine
●​ SQL query interpreter
●​ Regex engines

How it works

1.​ User writes a program/script.


2.​ Interpreter reads statements one by one.
3.​ Each statement is parsed and executed immediately.
4.​ Results affect the execution environment.

Why Interpreter Style fits

●​ Language semantics are explicitly modeled.


●​ Execution is driven by interpretation, not compilation.
●​ Ideal when flexibility and extensibility are important.

4. Example 2: Mobile Code Architecture


What is Mobile Code

Mobile code refers to program code that moves across machines and is executed locally
by an interpreter or runtime.

Examples:

●​ Java applets (historically)


●​ JavaScript in browsers
●​ Smart contracts
●​ Plugins or scripts downloaded at runtime

How Interpreter Style applies

●​ The remote system sends code, not just data.


●​ The receiving system already has:
○​ An interpreter/runtime
○​ A defined execution environment
●​ The code is:
○​ Loaded dynamically
○​ Interpreted or executed in a sandbox

Mobile Code Flow


[ Remote Server ]
|
| (code)
v
[ Local Interpreter / Runtime ]
|
v
[ Execution Environment ]

Why Interpreter Style fits Mobile Code

●​ No recompilation required.
●​ Platform-independent execution.
●​ Safe sandboxing possible.
●​ Behavior can change dynamically without redeploying the system.

5. Key Characteristics Summary


Aspect Interpreter Style

Execution Runtime interpretation

Flexibility Very high

Performance Slower than compiled

Use cases DSLs, scripting, dynamic systems

Control flow Driven by interpreted instructions


Great, let’s finish with Layered Architecture, explained in the same clean, exam-ready way,
with analogy → formal explanation → examples, focusing on Client–Server and Virtual
Machine.

1. Layered Architecture (with analogy)


Think of a multi-floor building:

●​ Each floor (layer) has a specific responsibility.


●​ People on one floor don’t interact with all other floors directly.
●​ Requests move up and down through floors in an organized way.
●​ If you renovate one floor, the others usually don’t need to change.

Mapping to software:

●​ Each layer provides services to the layer above it.


●​ Each layer uses services of the layer below it.
●​ Responsibilities are clearly separated.

👉
Key idea:​
System functionality is organized into layers, each with a well-defined role.

2. Layered Architecture (formal explanation)


Definition

Layered Architecture is a software architecture style where:

●​ The system is organized into hierarchical layers.


●​ Each layer:
○​ Performs a specific role
○​ Depends only on the layer directly below it
●​ Communication flows in a controlled direction (typically top → bottom).

Typical Layers
1.​ Presentation Layer
○​ User interface
○​ Handles input/output, formatting, display
2.​ Application / Business Logic Layer
○​ Implements business rules
○​ Coordinates workflows
3.​ Data Access Layer
○​ Handles database interactions
○​ Abstracts storage details
4.​ Infrastructure / System Layer
○​ OS, network, hardware interfaces

General Diagram
+----------------------+
| Presentation Layer |
+----------------------+
| Business Logic Layer |
+----------------------+
| Data Access Layer |
+----------------------+
| Infrastructure Layer |
+----------------------+

3. Characteristics
●​ High maintainability: Changes are localized to layers.
●​ Reusability: Lower layers can serve multiple higher layers.
●​ Replaceability: Layers can be swapped if interfaces stay stable.
●​ Controlled dependencies: Prevents tight coupling.

4. Example 1: Client–Server Architecture


Why it is Layered

Client–Server naturally follows a layered structure:

Client Side
●​ Presentation layer (UI, browser, mobile app)

Server Side

●​ Business logic layer (APIs, services)


●​ Data access layer (database, storage)

Flow
[ Client (UI) ]
|
v
[ Server (Logic) ]
|
v
[ Database ]

Why Layered Architecture fits

●​ Client handles presentation only.


●​ Server handles logic and data.
●​ Clear separation of concerns.
●​ Independent development and scaling.

5. Example 2: Virtual Machine Architecture


What it is

A Virtual Machine (VM) is a layered system that abstracts hardware and provides a uniform
execution environment.

Layers in a Virtual Machine


+----------------------+
| Application Code |
+----------------------+
| Virtual Machine API |
+----------------------+
| Virtual Machine |
+----------------------+
| Host OS / Hardware |
+----------------------+

How this is Layered Architecture

●​ Applications don’t interact with hardware directly.


●​ VM layer:
○​ Interprets or compiles instructions
○​ Manages memory and execution
●​ Hardware details are hidden from applications.

Examples

●​ Java Virtual Machine (JVM)


●​ .NET CLR
●​ WebAssembly runtimes

Why Layered Architecture fits

●​ Portability: Same code runs on different hardware.


●​ Isolation: Applications are separated from the OS.
●​ Security: VM enforces execution rules.

6. Advantages and Disadvantages


Advantages

●​ Clear structure
●​ Easy maintenance
●​ Testable layers
●​ Technology independence

Disadvantages
●​ Performance overhead
●​ Rigid layer boundaries
●​ Sometimes unnecessary abstraction

You might also like