1. Home
  2. Explore
  3. Computer Science
  4. Software Architecture Patterns

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Software Architecture Patterns

  • 85Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Application Structures

What is layered architecture, and how does it organize an application?

85 questions

  1. 1

    What is layered architecture, and how does it organize an application?

    Model answer

    It divides an application into distinct layers, each with a specific responsibility.

    Explanation

    The separation assigns different kinds of work to different parts of the system.

  2. 2

    What are the roles of the data, business, application, and presentation layers?

    Model answer

    The data layer stores raw data, the business layer handles core logic, the application layer executes and coordinates tasks, and the presentation layer provides the user interface.

    Explanation

    Each layer has a different responsibility, from storing information to presenting it to users.

  3. 3

    How does separation of concerns benefit a layered application?

    Model answer

    It lets layers be developed and maintained more independently, making the system easier to adapt and troubleshoot.

    Explanation

    Changes or problems in one responsibility can be addressed without necessarily changing every other layer.

  4. 4

    What trade-offs can arise when a layered architecture has too many layers?

    Model answer

    Too many layers can increase complexity, and communication between layers can create performance bottlenecks.

    Explanation

    The architecture needs an appropriate balance between separation and the overhead of additional layers.

  5. 5

    How might an e-commerce platform or banking app use layered architecture?

    Model answer

    Different layers can handle data, business processes such as payments or transactions, application tasks, and the user interface.

    Explanation

    These applications can separate their information and processing from the interface users interact with.

  6. 6

    In the Model-View-Controller pattern, what responsibility belongs to the model?

    Model answer

    The model represents the application's data and logic.

    Explanation

    It is the part of MVC that holds the information and rules used by the application.

  7. 7

    What roles do the controller and view perform in MVC?

    Model answer

    The controller handles user input and updates the model, while the view displays information to the user.

    Explanation

    The controller processes interactions, and the view presents the resulting information.

  8. 8

    How would MVC represent the parts of an online store where a shopper views products and adds an item to a cart?

    Model answer

    The product catalog is part of the model, adding an item to the cart is handled by the controller, and the product page is the view.

    Explanation

    This example separates the store's data, interaction handling, and presentation.

  9. 9

    What are two benefits of using MVC in a web application?

    Model answer

    MVC can make code more reusable and testing simpler, while making updates less likely to cause widespread changes.

    Explanation

    Separating the model, view, and controller helps organize application responsibilities.

  10. 10

    When might MVC be a poor fit for an application?

    Model answer

    It may add unnecessary overhead to a simple application and become complex in a very large application with many views and controllers.

    Explanation

    The pattern's organizational benefits may not justify its overhead in every project.

  11. 11

    How does a client-server architecture divide responsibilities?

    Model answer

    A central server manages and provides resources or services, while clients request and use them.

    Explanation

    Clients access resources through the server rather than managing the central resource themselves.

  12. 12

    What does the library analogy illustrate about client-server architecture?

    Model answer

    The library represents the server holding resources, and a visitor requesting a book represents a client asking for a resource.

    Explanation

    The server supplies centrally managed resources in response to client requests.

  13. 13

    What are advantages of the centralized approach in client-server architecture?

    Model answer

    It can make maintenance easier and provide greater security and control over resources.

    Explanation

    Central management gives the system one place to administer access and resources.

  14. 14

    What is the single point of failure risk in a client-server system?

    Model answer

    If the server fails, clients may lose access to the services and resources it provides.

    Explanation

    Clients depend on the central server, so its failure can affect all of them.

  15. 15

    How can a client-server system reduce the impact of server failure?

    Model answer

    It can use redundancy and backup mechanisms.

    Explanation

    These mechanisms help preserve service if a server becomes unavailable.

  16. 16

    How does an email service illustrate client-server architecture?

    Model answer

    The server stores emails and manages sending and receiving, while an email app acts as a client for accessing and managing messages.

    Explanation

    The app requests access to email services managed by the server.

  17. 17

    How does master-slave architecture divide work between its components?

    Model answer

    The master makes decisions and delegates tasks, while slave components carry out assigned tasks and report back.

    Explanation

    The pattern separates coordination from task execution.

  18. 18

    How can adding slave components help a master-slave system handle more work?

    Model answer

    More workers can be added to take on tasks as the workload grows.

    Explanation

    The master can distribute work across additional components.

  19. 19

    How can master-slave architecture support fault tolerance when a worker is unavailable?

    Model answer

    The master can reassign that worker's task to another available worker.

    Explanation

    Reassignment can allow the system's work to continue despite a worker failure.

  20. 20

    What risk arises if the master component fails, and how can it be addressed?

    Model answer

    The master can be a single point of failure; a failover mechanism can let a backup master take over.

    Explanation

    A replacement master maintains coordination if the primary master goes down.

  21. 21

    What performance challenge can occur in a large master-slave system?

    Model answer

    Communication between the master and many slaves can become complicated and affect performance, so communication overhead should be minimized.

    Explanation

    Coordination traffic can increase as the system grows.

  22. 22

    How can master-slave architecture be used for database replication or load balancing?

    Model answer

    For replication, data is copied to multiple servers so a replica can serve if one fails; for load balancing, the master distributes incoming traffic across servers.

    Explanation

    Both uses rely on a coordinating component to direct or replicate work.

  23. 23

    What is the main idea behind microservices architecture?

    Model answer

    It divides a large application into smaller, independent services, each focused on a particular task or function.

    Explanation

    The services collaborate rather than being built as one massive interconnected application.

  24. 24

    How can microservices support independent development and deployment?

    Model answer

    Teams can work on individual services without changing the others, which can speed development and deployment.

    Explanation

    The services are designed to operate independently while working together.

  25. 25

    How does microservices architecture allow a system to scale a busy function?

    Model answer

    The busy service can be scaled independently without scaling the rest of the system.

    Explanation

    Each service can receive resources according to its own demand.

  26. 26

    What challenges can arise as the number of microservices grows?

    Model answer

    Communication and coordination become more complex, network congestion may increase, and each service and its interactions must be secured.

    Explanation

    A network of independent services introduces coordination, network, and security concerns.

  27. 27

    How does Netflix illustrate the use of microservices?

    Model answer

    Its services handle specific functions, such as user authentication or content recommendations, helping the platform scale and adapt.

    Explanation

    Dividing functions among services supports a large streaming platform's changing demands.

  28. 28

    What is the central idea of space-based architecture?

    Model answer

    It distributes workload across multiple processing units that access a shared memory space.

    Explanation

    The processing units work together using shared resources rather than relying on one powerful server.

  29. 29

    How does space-based architecture increase capacity for heavy workloads?

    Model answer

    Work is distributed across multiple nodes, and capacity can be increased by adding more processing units.

    Explanation

    Additional nodes can contribute to handling more data or traffic.

  30. 30

    What data-management challenge must space-based systems address?

    Model answer

    They must maintain data consistency across the different nodes.

    Explanation

    Distributed components need compatible, consistent information to work correctly.

  31. 31

    How can communication affect the performance of a space-based system?

    Model answer

    Communication among distributed components can introduce latency, which must be managed carefully.

    Explanation

    Delays in communication can affect the system's performance.

  32. 32

    What kinds of applications are given as examples of space-based architecture?

    Model answer

    Large e-commerce platforms handling many transactions and online games supporting many real-time players are examples.

    Explanation

    Both kinds of systems must handle large, simultaneous workloads.

  33. 33

    What makes an architecture event-driven?

    Model answer

    It reacts to events or changes, such as user actions, sensor readings, or internal system changes, by triggering actions.

    Explanation

    Events initiate responses rather than the system following only a fixed sequence.

  34. 34

    Why can event-driven architecture make an application responsive and adaptable?

    Model answer

    The system can respond to events as they occur instead of following only a predetermined path.

    Explanation

    Its behavior is triggered by changes in the environment or system.

  35. 35

    Why is event-driven architecture useful for stock trading or online gaming?

    Model answer

    These applications need to process events and respond quickly in real time.

    Explanation

    Trading activity and player actions may require immediate system responses.

  36. 36

    What makes event-driven systems difficult to design, debug, and test?

    Model answer

    Asynchronous events can happen at the same time, making system behavior and interactions harder to trace.

    Explanation

    Concurrent event processing complicates understanding how a system reached a particular result.

  37. 37

    Why are reliability and unintended consequences important concerns in event-driven architecture?

    Model answer

    The system must handle asynchronous events reliably and prevent event-triggered actions from causing unintended effects.

    Explanation

    Events can trigger chains of actions that need careful coordination.

  38. 38

    How do real-time analytics dashboards and fraud detection systems use event-driven architecture?

    Model answer

    Dashboards update as new data arrives, while fraud systems monitor transactions and trigger alerts about suspicious activity.

    Explanation

    Both systems respond to incoming events as they occur.

  39. 39

    How might a car's anti-lock braking system use event-driven architecture?

    Model answer

    It can react immediately to conditions that could lock a wheel and act to prevent the lock-up.

    Explanation

    The system responds to events in order to control braking in real time.

  40. 40

    What role does a broker play in broker architecture?

    Model answer

    The broker receives client requests and routes them to appropriate servers, facilitating communication between components.

    Explanation

    The broker connects clients and servers that do not interact directly.

  41. 41

    How does broker architecture decouple clients from servers?

    Model answer

    Clients communicate through the broker instead of interacting directly with servers.

    Explanation

    The broker mediates and routes communication between the two sides.

  42. 42

    How can broker architecture support flexibility, scalability, and fault tolerance?

    Model answer

    Servers can be added or removed without disrupting the whole system, and the broker can redirect requests if a server fails.

    Explanation

    The broker manages routing between clients and available servers.

  43. 43

    What challenges must be considered when implementing a broker?

    Model answer

    The design must address routing logic, load balancing, and security.

    Explanation

    The broker is responsible for coordinating important system interactions.

  44. 44

    Why can the broker itself become a single point of failure?

    Model answer

    If the broker fails, it may no longer be able to route communication; failover mechanisms can reduce this risk.

    Explanation

    The system depends on the broker to connect clients and servers.

  45. 45

    How might broker architecture support enterprise system integration or message exchange?

    Model answer

    A broker can coordinate data exchange among systems such as CRM, ERP, and HR applications, or route messages among applications and services.

    Explanation

    The broker provides a managed communication point for otherwise separate systems.

  46. 46

    What is the core system's role in microkernel architecture?

    Model answer

    The core provides the system's essential functionality.

    Explanation

    Specialized functionality is added around this minimal foundation.

  47. 47

    What do plug-in modules do in microkernel architecture?

    Model answer

    They extend the core with specialized features or customizations and can be added or removed as needed.

    Explanation

    The modules provide functionality beyond the core's essential services.

  48. 48

    Why is microkernel architecture considered flexible and scalable?

    Model answer

    New features can be added or existing ones updated without disrupting the core system.

    Explanation

    The plug-in structure allows the system to be extended in modules.

  49. 49

    How can microkernel architecture make maintenance more localized?

    Model answer

    A plug-in can be fixed or updated without affecting other parts of the system.

    Explanation

    The modular design isolates specialized functionality.

  50. 50

    What are two potential drawbacks of microkernel architecture?

    Model answer

    Communication between the core and many plug-ins can become complicated, and a minimal core may require functionality to be built from scratch.

    Explanation

    Modularity can increase coordination needs and may provide fewer built-in features.

  51. 51

    How do operating systems illustrate microkernel architecture in the described example?

    Model answer

    The kernel handles basic tasks such as memory management and process scheduling, while device drivers and other components provide specialized functions as plug-ins.

    Explanation

    The example distinguishes essential core tasks from additional component functionality.

  52. 52

    What happens to data in pipe-filter architecture?

    Model answer

    Data flows through a sequence of filters, each of which performs a specific operation before passing the data on.

    Explanation

    The filters process data in stages, like stations on an assembly line.

  53. 53

    How does pipe-filter architecture support flexible data-processing workflows?

    Model answer

    Filters can be added or removed to change the workflow, and independent filters can be reused in different pipelines.

    Explanation

    The modular filters support both adaptation and code reuse.

  54. 54

    Why can debugging a pipe-filter pipeline be difficult?

    Model answer

    If the final output is wrong, the source of the problem may need to be traced through each filter.

    Explanation

    Errors in an early stage can affect the output of later stages.

  55. 55

    What data-format constraint must pipe-filter components satisfy?

    Model answer

    Filters must agree on how data is represented and transferred between them.

    Explanation

    A filter's output must be usable as the next filter's input.

  56. 56

    How do compilers or image-processing systems use pipe-filter architecture?

    Model answer

    A compiler can pass source code through stages such as lexical analysis, parsing, and code generation; image processing can apply filters such as blurring, sharpening, and color correction.

    Explanation

    Both examples transform data through a sequence of specialized operations.

  57. 57

    What is the central blackboard in Blackboard architecture?

    Model answer

    It is a shared data store containing information about the problem being solved.

    Explanation

    Specialized modules use the shared information to contribute to a solution.

  58. 58

    How do specialized modules contribute to a solution in Blackboard architecture?

    Model answer

    They read and write information on the blackboard, adding information, analyzing existing data, and proposing solutions.

    Explanation

    Modules contribute their expertise indirectly through the shared data store.

  59. 59

    What kinds of problems are well suited to Blackboard architecture?

    Model answer

    It is useful for problems involving uncertain or incomplete data where a solution emerges gradually through collaboration.

    Explanation

    Different modules can contribute as more information becomes available.

  60. 60

    How could a speech-recognition system use Blackboard architecture?

    Model answer

    Different modules could analyze audio, identify phones, match words, and interpret meaning while contributing their results to a shared blackboard.

    Explanation

    The modules contribute distinct parts of the analysis to help build an overall result.

  61. 61

    What coordination problem must be managed in a Blackboard system?

    Model answer

    When many modules contribute at once, the system must keep shared data consistent and synchronized to avoid conflicts.

    Explanation

    Reliable collaboration depends on managing concurrent contributions.

  62. 62

    What does Interpreter architecture provide for a language?

    Model answer

    It defines a grammatical representation for the language and an interpreter that processes and executes instructions written in it.

    Explanation

    The architecture connects the language's grammar with its execution.

  63. 63

    How does a programming-language interpreter use the interpreter pattern?

    Model answer

    It processes human-readable code, such as Python or JavaScript, and translates its instructions into actions the computer can execute.

    Explanation

    The interpreter gives meaning to the language's instructions as it processes them.

  64. 64

    Why might a business application use Interpreter architecture for a rule engine?

    Model answer

    A specialized language can express business rules, and an interpreter can evaluate those rules against data.

    Explanation

    The pattern supports creating and executing a language tailored to a particular domain.

  65. 65

    What performance and debugging trade-offs can arise with interpreted languages?

    Model answer

    Interpreted code may be slower than compiled code because it is executed line by line, and debugging can be harder because of the extra interpretation layer.

    Explanation

    The flexibility of interpretation can come with execution and troubleshooting costs.

  66. 66

    What does the Repository pattern mediate between?

    Model answer

    It mediates between an application's domain logic and its data-access layer.

    Explanation

    The repository provides a boundary between core application logic and data storage operations.

  67. 67

    What does a repository provide to application code?

    Model answer

    It provides a clean interface for retrieving and persisting data while hiding the complexity of the underlying database or data store.

    Explanation

    Application code can use the repository without directly handling storage details.

  68. 68

    How can the Repository pattern make an application easier to test and maintain?

    Model answer

    It promotes loose coupling between application parts, making them easier to test and maintain.

    Explanation

    Separating data access from domain logic reduces dependencies between those parts.

  69. 69

    What change can be made more easily when an application uses a repository?

    Model answer

    The database or data-access logic can be changed by updating the repository without changing the rest of the application.

    Explanation

    The repository hides storage details behind its interface.

  70. 70

    When might the Repository pattern be unnecessary or difficult to implement?

    Model answer

    It may add needless complexity to an application with simple data-access needs, and designing a generic repository for many kinds of operations can be challenging.

    Explanation

    The pattern's benefits depend on the complexity and variety of an application's data access.

  71. 71

    What does the Strategy pattern do with algorithms?

    Model answer

    It defines a family of algorithms, encapsulates each one, and makes them interchangeable.

    Explanation

    The application can select among different approaches without treating them as one fixed procedure.

  72. 72

    How could a navigation app use the Strategy pattern?

    Model answer

    It could switch among routing algorithms for shortest distance, fastest travel time, or avoiding tolls based on the user's needs.

    Explanation

    Each routing method is an interchangeable strategy for calculating a route.

  73. 73

    How can the Strategy pattern improve code reuse and testing?

    Model answer

    Algorithms can be reused in different parts of an application and tested independently.

    Explanation

    Encapsulating algorithms separates them from the context that uses them.

  74. 74

    How does the Strategy pattern support extending an application?

    Model answer

    New algorithms can be added without changing existing code.

    Explanation

    New strategies can be introduced as additional interchangeable options.

  75. 75

    When might the Strategy pattern be excessive?

    Model answer

    It may add unnecessary complexity when there are only one or two simple algorithms or when the algorithms are very similar.

    Explanation

    Separating strategies is most useful when meaningful flexibility or extensibility is needed.

  76. 76

    What should developers establish before selecting an architecture pattern?

    Model answer

    They should understand the project's specific requirements and constraints.

    Explanation

    A pattern should be chosen to fit the project's actual needs.

  77. 77

    Which project factors should be considered when choosing an architecture pattern?

    Model answer

    Relevant factors include application size and complexity, performance requirements, security needs, and budget limitations.

    Explanation

    These constraints can influence which architectural trade-offs are acceptable.

  78. 78

    Why should a team's skills and experience influence the choice of architecture?

    Model answer

    A pattern the team understands is more likely to be implemented successfully than one selected only because it is new or fashionable.

    Explanation

    The team's ability to work effectively with a pattern matters to project success.

  79. 79

    How should a team evaluate the strengths and weaknesses of candidate patterns?

    Model answer

    It should compare each pattern's strengths and weaknesses against the project's specific requirements.

    Explanation

    A pattern's general advantages matter only in relation to the project being built.

  80. 80

    Which patterns might be considered when scalability and fault tolerance are top priorities?

    Model answer

    Microservices or space-based architecture may be suitable options to consider.

    Explanation

    Both are presented as candidates when those qualities are especially important.

  81. 81

    Which patterns might be considered when ease of maintenance and development are priorities?

    Model answer

    Layered architecture or MVC may be suitable options to consider.

    Explanation

    These patterns can help organize application responsibilities.

  82. 82

    How can the kind of data being handled influence architecture selection?

    Model answer

    Complex data relationships and consistency needs may favor the Repository pattern, while data processed in stages may favor pipe-filter architecture.

    Explanation

    Different patterns address different data-management and data-processing needs.

  83. 83

    Can software architecture patterns be combined or adapted?

    Model answer

    Yes. Patterns can be adapted or blended to address the specific challenges of a project.

    Explanation

    Patterns are guides for solving problems, not rules that must be followed rigidly.

  84. 84

    Why is there no single architecture pattern that is best for every project?

    Model answer

    Patterns have different strengths and weaknesses, and every choice involves trade-offs that must be matched to project goals.

    Explanation

    The right choice depends on requirements, constraints, and which compromises are acceptable.

  85. 85

    What is the goal of using architecture patterns as guides rather than strict rules?

    Model answer

    The goal is to balance structure with flexibility and build software that is robust, maintainable, and adaptable to changing user needs.

    Explanation

    Patterns provide a foundation while leaving room to tailor a solution to the project.

1 of 85
Question 1 of 85

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent