s6 Flashcards
(31 cards)
What is a key consideration when observing architectural styles in real systems?
Real systems, especially large ones, rarely use a single architectural style; they often employ a hybrid approach, mixing several styles. For example, Skype combines Client-Server with Peer-to-Peer.
Define Monolithic Architecture.
A single-tiered software system where all requirements (user interface, business rules, data access) are combined into a single platform or application. It is self-contained, with one application overseeing all functionality.
Provide an example of Monolithic Architecture
Microsoft Word
where user interface, business rules (like line breaks and text wrapping), and data access are all in one application, deployed on a single device.
Other examples include old financial systems and many simple video games.
List pros of Monolithic Architecture.
Easy to develop.
Easy to deploy.
List cons of Monolithic Architecture.
Codebase becomes harder to understand over time.
Large size can decrease performance.
Difficult to maintain and change.
Difficult to scale (can only scale by running multiple copies).
Forces commitment to specific technologies.
Hard to swap out components later.
Define Client-Server Architecture.
An architecture that divides software system functionality into two conceptual parts: a server that provides resources/services and listens for requests, and a client that requests these resources/services.
What is a key benefit of separating the client and server?
It introduces a layer of abstraction; the client does not need to know how the server performs its tasks, viewing the server as a black box. Servers may use an API to format messages between client and server.
How does a server typically handle multiple clients?
One server can accommodate multiple clients, usually requiring some form of scheduling system.
Give an example of Client-Server Architecture.
A simple website where the user’s web browser is the client, and the web server hosting the site is the server. Requests and responses occur via HTTP/HTTPS.
List pros of Client-Server Architecture.
Separation of concerns.
Scalability (new clients/servers can be added, servers can be upgraded).
Centralized control allows for tighter security and easier development.
Clients and servers can be deployed anywhere.
List cons of Client-Server Architecture.
Can be difficult to manage traffic.
Server failure can cause the entire system to fail.
Maintaining servers can be costly.
What is Multi-Tier Architecture?
A family of architectural styles based on the Client-Server model, focused on dividing a software system into multiple layers or tiers.
Describe the 2-Tier Model.
The prototypical client-server model where the client handles presentation, and the server handles logic and data.
Describe the 3-Tier Model and give an example.
Presentation tier: Handles user interface.
Application tier: Handles system logic.
Data tier: Handles data storage and retrieval.
Example: Web applications, where the presentation tier is rendered by the client’s browser, the application tier is middle-layer software processing content and requests, and the data tier is the back-end database.
What is an N-Tier Model?
A generalization of the 3-tier model with ‘n’ distinct layers. Common layers include: Presentation, Business (sometimes split into Business and Application/Services), Persistence, and Database. Layers are isolated, meaning changes in one layer generally don’t affect others.
What are the core principles of Multi-Tier Architecture?
Layers are isolated: Changes in one layer generally don’t impact other layers.
Separation of concerns: Components in a layer deal only with logic pertaining to that layer.
Layers are closed: Layers typically only interact with the layer directly above or below them (requests move layer by layer).
What are variants to the “closed layers” principle in Multi-Tier Architecture?
Open layers: Allow communications to skip the layer immediately adjacent.
Specific components: Some components can interact with components in multiple layers, effectively forming their own layer.
List pros of Multi-Tier Architecture.
Allows for greater scalability.
Separation of the data tier/layer improves security and data integrity.
Easier to maintain and upgrade due to isolation and separation of concerns.
Easy to test due to isolation (dummy layers can be used).
List cons of Multi-Tier Architecture.
Dividing the system into layers can be difficult to design and implement.
Adding too many layers can increase complexity.
Architecture sinkhole: Requests flow through multiple layers with little or no processing.
Without careful management, layered systems can drift into monolithic architectures.
What is Representational State Transfer (REST)?
An architectural style that standardizes web systems. Web services conforming to REST are called RESTful. It builds on the Client-Server architecture.
List the six constraints of REST.
Client-Server architecture: Enforces separation of concerns.
Statelessness: The server does not retain session information; each request is understood in isolation.
Cacheability: Clients and intermediaries can cache responses; servers define if responses are cacheable.
Layered system: Clients cannot tell if they are connected to the end server or an intermediary.
Code on demand (optional): Servers can extend client functionality by transferring executable code (e.g., JavaScript).
Uniform interface: Standardized interface for requests and responses.
What are the four key requirements of the Uniform Interface constraint in REST?
Resource identification in requests: Individual resources are identified (e.g., using URIs); a representation (e.g., JSON, HTML) may be returned.
Resource manipulation through representations: The returned representation has enough info for the client to manipulate the resource.
Self-descriptive messages: Messages contain the information needed to process them (e.g., file type).
(The fourth requirement is Hypermedia as the Engine of Application State - HATEOAS, though not explicitly detailed in this section of the presentation, it’s a fundamental part of a uniform interface).
Describe an example of an HTTP-based RESTful web application.
Resources identified using URIs (e.g.,http://example.webapplication.com).
Responses defined by media types (e.g., application/json, image/png).
Requests use HTTP protocol (GET, POST, PUT, DELETE).
Define Safe, Idempotent, and Cacheable in the context of HTTP methods.
Safe: Method does not change the server’s state.
Idempotent: Using the method multiple times on a resource is equivalent to using it once.
Cacheable: Responses can be cached for future reuse.