week 8 Flashcards
(11 cards)
what is pipe and filter
refers to sequential chain of components where output of one becomes input of another.
functional components are called filters and the connections between filters are pipes
Making a smoothie:
Fruit Chunks (Data Source)
-> Pipe -> Blender (Filter 1: chops and mixes) -> Pipe ->
Sieve (Filter 2: removes seeds/pulp) -> Pipe ->
Smoothie in Glass (Data Target)
Pros of pipe and filter
easy to understand and link to business practices
can reuse components
easy to add components
cons of pipe and filter
hard to make interactive ( bad for back and forth systems more for one way data processing)
performance bottlenecks - whole line is as fast as its slowest filter.
The model view controller MVC
Model: Manages data and business logic (the brains).
View: What the user sees and interacts with (the UI).
Controller: Takes user input from View, tells Model what to do, updates View.
Simple Example: Ordering at a restaurant: Menu (View), you tell Waiter (Controller), Waiter tells Kitchen (Model), Kitchen prepares food, Waiter brings it (updates View).
pros of MVC
-organized - similar parts are grouped together
- good for teamwork, simultaneous development, easy to modify
cons of MVC
code can become very complex
can be difficult to maintain consistency when a feature is split between 3 components
Model-View-Presenter (MVP)
What it is: An intermediary called the Presenter sits between the Model and View.
View: More “passive”; handles user input/events and passes them to the Presenter. Has an interface for the Presenter to update it. View and Model don’t talk directly.
Presenter: Contains UI logic. Fetches data from Model, formats it, tells View what to display. Interprets View’s inputs to update Model.
Model: Manages data and business logic.
Key Characteristics: Presenter often has a reference to the View’s interface. Communication is typically through method calls. View is often dumbed down.
Primary Benefit/Use Case: Improves testability (Presenter logic can be tested without a UI). Often used in Android development and where a clear separation between UI and presentation logic is desired.
Distinguishing Feature: Presenter “supervises” or “conducts” the View. View is often more dependent on the Presenter for updates.
Model-View-ViewModel (MVVM)
What it is: An intermediary called the ViewModel sits between the Model and View.
View: Binds directly to properties and commands exposed by the ViewModel using data binding. Updates automatically when ViewModel data changes (and can update ViewModel data with two-way binding).
ViewModel: Holds presentation logic and the state for the View (data prepared for display). Gets data from Model, transforms/shapes it for the View. ViewModel does NOT have a direct reference to the View.
Model: Manages data and business logic.
Key Characteristics: Relies heavily on data binding frameworks. ViewModel exposes data and commands that the View can bind to.
Primary Benefit/Use Case: Excellent for frameworks with strong data binding support (e.g., WPF, Angular, Vue.js, Jetpack Compose). Enhances testability of the ViewModel (as it has no View dependency). Allows UI designers and developers to work more independently.
Distinguishing Feature: Data binding is the primary communication method between View and ViewModel. ViewModel is unaware of the specific View.
what is Event-Driven Architecture (EDA) , pros and cons
What it is: System components react to “events” (significant occurrences). Event Producers create events, Event Consumers react to them. They don’t call each other directly.
Simple Example: Doorbell: Pressing button (Producer) creates “doorbell pressed” event. Chime (Consumer) hears event and rings.
Pros: Parts are independent (loose coupling), scalable (add more consumers easily), responsive to real-time occurrences.
Cons: Can get complex to track event flows, debugging can be tricky due to asynchronous nature.
Microkernel (Plugin Architecture), pros and cons
What it is: A minimal Core System provides basic functions, and extra features are added via independent Plug-ins (extensions).
Simple Example: Web browser (core handles basic Browse) with extensions/add-ons (like ad blockers, password managers) as plug-ins.
Pros: Flexible & extensible (add features via plug-ins), small core can be stable, third parties can create plug-ins.
Cons: Core is critical (hard to change core without affecting plug-ins), managing many plug-ins can be complex.
Microservices
What it is: Application is built as a collection of small, independent services. Each service does one specific business job and can be deployed and scaled separately. Services talk over a network (APIs).
Simple Example: Large online store: Separate services for User Accounts, Product Catalog, Orders, Payments. Webpage talks to these small services.
Pros: Independent teams/tech, scales well (scale only needed services), potentially resilient (one service failing might not take down everything), easier to update individual services.
Cons: Complex to manage many services (DevOps heavy), network communication adds latency, harder to test the whole system together, overkill for small apps.