s7 Flashcards
(30 cards)
Define Pipe-and-Filter Architecture.
Also called pipeline architecture, it’s a sequential chain of functional components (filters) where the output of one filter becomes the input of the next, connected by “pipes.”
Give an example of Pipe-and-Filter Architecture.
UNIX shell commands (e.g., ls folder-name | grep -v match-string | more). Another example is a simple invoice system processing invoices through stages like reading, identifying payments, finding dues, and issuing reminders. Angular Pipes also use this concept.
List pros of Pipe-and-Filter Architecture.
Easy to understand and link to business practices.
Can reuse components (filters).
Easy to extend by adding new components.
Can be sequential or concurrent.
List cons of Pipe-and-Filter Architecture.
Very hard to make interactive.
Potential for performance bottlenecks.
Describe the Model-View-Controller (MVC) architecture.
It separates a software system into three components:
Model: Manages data, business rules, and system logic.
View: Presents the model to the user (includes the user interface).
Controller: Accepts user input and passes it to the model. The user sees the View and uses the Controller, which manipulates the Model, and the Model updates the View.
Provide examples of MVC architecture.
Web application: Model (database on server), View (HTML on client’s browser), Controller (JavaScript script from server to client). Note: MVC can be imposed on a client-server model.
Video games: Model (game world, player state), View (rendered game world, UI, audio), Controller (listens for user inputs).
List pros of MVC Architecture.
Simultaneous development of components.
High cohesion (related parts grouped together).
Low coupling (components are separate, interact via specific interfaces).
Easy to modify.
Extensibility (e.g., multiple views for the same model).
List cons of MVC Architecture.
Code can become very complex.
Can be difficult to maintain consistency when a feature is split across three components.
Describe Model-View-Presenter (MVP).
A variant of MVC where a Presenter acts as an intermediary between the View and the Model (which don’t communicate directly). The View handles user input (unlike in classic MVC), and the Presenter formats model data for the View and interprets inputs from the View. Easier to fit into Client-Server models.
Describe Model-View-View Model (MVVM).
A variant where a ViewModel acts as an intermediary. Unlike MVP, the ViewModel doesn’t know about the View. The View directly binds to parts of the ViewModel using a binder. Example: Windows Presentation Foundation (WPF).
What are key differences between MVP and MVVM regarding View and UI Communication?
MVP: View is passive, handled by Presenter. UI communication is View <-> Presenter (manual method calls).
MVVM: View is active, binds directly to ViewModel. UI communication is View <-> ViewModel (data binding, observers).
Describe Hierarchical Model-View-Controller (HMVC).
A set of MVC triads arranged hierarchically. Higher-level controllers can communicate with lower-level controllers. Allows dynamic control of different parts of a layout without needing to rerender everything. Example: a website with embedded widgets.
Define Event-Driven Architecture (EDA).
An architectural style centered on events, where an event is a change of state (hardware or software). Components are either event producers (detect and emit responses to events) or event consumers/processors (receive messages about events and react). Communication is handled by event channels.
Give an example of EDA.
A security system where producers are doors/sensors/cameras, and consumers are alarms/security calls/door locks.
What are the two main topologies in EDA?
Mediator Topology
Broker Topology
Describe the Mediator Topology in EDA.
Consists of event producers, an event queue, an event mediator, event channels, and event consumers. Producers trigger events, which go to an event queue. The mediator reads events from the queue and passes them to appropriate event channels, which consumers listen to.
Describe the Broker Topology in EDA.
Consists of a lightweight event broker that contains all event channels. There is no central mediator to coordinate tasks; producers publish events to channels, and consumers subscribe to these channels.
List pros of Event-Driven Architecture.
Loose coupling (producers and consumers are independent and can evolve separately).
Components can be replaced seamlessly.
No single point of failure (especially in broker topology).
Less technical load (no server constantly listening for requests in the same way).
Scales well.
List cons of Event-Driven Architecture.
Can be overly complicated to design and understand.
Difficult to debug due to inconsistent, asynchronous behavior.
Describe Microkernel Architecture (Plug-in Architecture).
Consists of two types of components:
Core System: Contains the minimum functionality required.
Plug-in Components: Independent, stand-alone components that extend the core system’s functionality. Example: IDEs like VSCode or Eclipse, where the core handles basic functions and plug-ins add features.
What is a common use case for Microkernel architecture?
It’s frequently used as part of another architecture, for example, replacing one of the layers in a multi-tier architecture. Its simplicity and extensibility make it a good starting point for product-based software.
List pros of Microkernel Architecture.
Lends itself to agile development.
Easy to deploy plug-ins.
Plug-ins can be tested easily due to their stand-alone nature.
Can lead to better performance (minimal core).
List cons of Microkernel Architecture.
Difficult to scale if major modifications are needed in the core system (affects every plug-in).
Can be difficult to develop the core system and plug-in management.