Software Architecture Overview
36 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the primary difference between a JSONArray and a JSONObject?

  • A JSONArray can only contain numbers, while a JSONObject can contain multiple types.
  • A JSONArray uses arrays, while a JSONObject uses only single values.
  • A JSONArray is a singular string-array mapping, while a JSONObject is a string-value mapping. (correct)
  • A JSONArray maps to key-value pairs, while a JSONObject maps to a string-array.
  • Which value is not a valid type to use inside a JSONObject?

  • Function (correct)
  • JSONArray
  • Boolean
  • Integer
  • Will the following code work for adding a list to a JSONObject? 'jsonObject.put("someList", list);'

  • No, because lists cannot be added to a JSONObject.
  • Yes, but only if the list contains strings.
  • Yes, JSON automatically converts appropriate lists to JSONArrays. (correct)
  • No, because lists must be serialized first.
  • What method is used to retrieve a double value from a JSONArray?

    <p>subArray.getDouble()</p> Signup and view all the answers

    What is the primary focus of Bottom-Up integration testing?

    <p>Starting with modules that have no dependencies</p> Signup and view all the answers

    What is a significant disadvantage of Bottom-Up integration testing?

    <p>It often leads to bad design choices</p> Signup and view all the answers

    What is one of the main benefits of using Sandwich integration testing?

    <p>It combines advantages of Top-Down and Bottom-Up approaches</p> Signup and view all the answers

    What do stubs simulate in integration testing?

    <p>The outputs of incomplete or unavailable modules</p> Signup and view all the answers

    How do drivers function in integration testing?

    <p>They call lower-level modules that are missing</p> Signup and view all the answers

    Why might Bottom-Up integration testing be considered complex?

    <p>It starts with the implementation before considering the interface</p> Signup and view all the answers

    Which scenario exemplifies the use of a stub in integration testing?

    <p>Replacing a database connection during a test</p> Signup and view all the answers

    What challenge does Sandwich integration testing often face?

    <p>Identifying an appropriate middle layer to start with</p> Signup and view all the answers

    What is the primary focus of a controller in software architecture?

    <p>Controlling the UI elements</p> Signup and view all the answers

    Which of the following is an advantage of the monolith architecture?

    <p>Lower server costs</p> Signup and view all the answers

    How does integration testing primarily differ from unit and system testing?

    <p>It tests smaller combinations of units.</p> Signup and view all the answers

    What is a drawback of Big-Bang integration testing?

    <p>It is challenging to trace faults.</p> Signup and view all the answers

    What is one of the primary benefits of Top-Down integration testing?

    <p>Easiest for prototyping a working application.</p> Signup and view all the answers

    Which statement best describes microservices architecture?

    <p>It is designed with independent services that interact over the web.</p> Signup and view all the answers

    What is a potential disadvantage of using microservices?

    <p>Performance loss on service indirection.</p> Signup and view all the answers

    What does unit testing specifically test?

    <p>An individual unit of the system.</p> Signup and view all the answers

    What is the primary function of the @Mock annotation in Mockito?

    <p>It initializes mock objects for testing.</p> Signup and view all the answers

    What is the correct syntax to specify what a mocked function should return using Mockito?

    <p>when(mockObject.function()).thenReturn(returnObject);</p> Signup and view all the answers

    How do you verify that a function was called exactly once?

    <p>verify(mockObject, times(1)).function();</p> Signup and view all the answers

    What is the purpose of the lenient() method in Mockito?

    <p>To allow unused when-then calls without failing the test.</p> Signup and view all the answers

    What does data persistence refer to?

    <p>Data that remains beyond the current execution of the program.</p> Signup and view all the answers

    What is the primary function of the presentation layer in the Three-Layer Architecture?

    <p>To serve information to the end-user</p> Signup and view all the answers

    In the context of software architecture, how would you differentiate between a component and a module?

    <p>Components are generally larger than modules.</p> Signup and view all the answers

    Which of the following is NOT a common means to achieve data persistence?

    <p>Writing data only in the program's memory.</p> Signup and view all the answers

    What is the main characteristic of the Client-Server architectural pattern?

    <p>There are two distinct components that communicate via a centralized server.</p> Signup and view all the answers

    What characterizes a JSONObject in JSON syntax?

    <p>It contains key-value mappings.</p> Signup and view all the answers

    What happens if you use a Map with a guard clause and forget a when-then statement in Mockito?

    <p>The test will fail due to an unrecognized function call.</p> Signup and view all the answers

    Which layer in the MVC architecture is analogous to the Business Logic layer in the Three-Layer Architecture?

    <p>Model Layer</p> Signup and view all the answers

    In the context of software components, what does a module typically consist of?

    <p>Functions and classes</p> Signup and view all the answers

    What defines server-side code in contrast to client-side code?

    <p>It is executed remotely on a server.</p> Signup and view all the answers

    What does each layer in the Three-Layer Architecture provide?

    <p>Services to the layer above and clients to the layer below</p> Signup and view all the answers

    How does the MVC architecture differ from the Three-Layer Architecture?

    <p>MVC combines the Data Layer and Business Logic Layer.</p> Signup and view all the answers

    Study Notes

    Software Architecture

    • Software architecture is a design pattern, a general framework for building software products.
    • Modules are smaller components, components are larger collections of modules. A function is a module, while a class containing multiple functions is a component.
    • Architectural patterns include Client-Server.
    • Client-Server Architecture: two separate components using communication (often done with separate codebases).
    • Servers act as central points, clients operate on various devices, and communicate only through the server.
    • Client-side code runs on the client's device, while server-side code runs remotely on the server. Results from the server are displayed on the client.
    • Three-Layer Architecture: presentation layer (serves end-users), business logic layer (enforces real-world rules), and data layer(stores data). Each layer interacts as a service to the layer above and a client to the layer below. Presentation layer can be GUI, API or CLI. Business logic checks for prerequisites (in courses, for example). Data layer handles data storage (databases).
    • MVC Architecture: similar to the three-layer architecture. It has a View, Model, and Controller layers. The model (data layer) handles data and business logic. The controller is for primarily managing UI interactions.
    • Monolith vs. Microservice: Monolith architecture has all code in a single application, while Microservice architecture separates code into smaller, independent services. Monoliths are easier for debugging and deploying, and have a lower server cost, but are difficult to update/maintain over time. Microservices are more scalable and easier to maintain, but debugging, logging, and server costs can be higher.

    Integration Testing

    • Integration testing tests the interaction between various components. It's a middle ground between unit and system testing (which tests individual components and the entire system respectively).
    • Big-Bang Integration testing involves haphazardly integrating units. It's simple but difficult to troubleshoot.
    • Top-Down integration testing begins with higher-level modules/components that depend on lower level ones, then works downward. Pro: easiest for prototyping; Con: requires stubs/mock data.
    • Bottom-Up integration testing focuses on lower level components with no dependencies, then works outward. Pros: Easier to trace errors, utilizes real code if possible; Cons: More complex.
    • Sandwich integration testing starts in the middle and uses bottom-up/top-down strategies for the remaining layers. Pro: combination of advantages; Cons: Difficulty in determining the 'middle' layer.

    Mockito

    • @Mock annotation - creates mock objects (doubles), useful for unit testing.
    • mock(ClassName.class) - creates mock objects on the fly.

    Data Persistence

    • Persistence refers to data that survives program execution. Common methods for storing data include plaintext (CSVs, Excel, TSVs) and databases (NoSQL or SQL). JSON syntax includes objects, arrays, strings, numbers, and booleans.

    Databases and SQLite

    • Tables are organized data structures with rows (records) and columns (attributes).
    • Records represent individual data entries, while columns define specific attributes.
    • A primary key is a unique identifier for each record, usually an integer.
    • A foreign key connects data in one table to a corresponding entry in another. Constraints like UNIQUE and NOT NULL enforce data integrity.
    • Queries are requests for data in a database that follow SQL language.

    JDBC

    • JDBC: a Java library for database connections and queries.
    • Defining connection: String connectionString = "jdbc:sqlite:database_filename.sqlite"; connection = DriverManager.getConnection(connectionString);
    • Closing connection: connection.close();
    • Auto-commit (false): changes are not made immediately, allowing later commit/rollback
    • Commit changes: connection.commit();
    • Rollback changes: connection.rollback();
    • Prepared Statements: faster, secure, and better.

    JavaFX

    • Panes are containers for UI components in JavaFX (including FlowPane).
    • Controls are UI elements like Labels and Buttons, which can receive user input and handle events.
    • FXML: an XML-based markup language to define/configure UI components.
    • Controllers: manage interactions with the UI.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Description

    Explore the fundamental concepts of software architecture, including modules, components, and various architectural patterns such as Client-Server and Three-Layer Architecture. This quiz will help you understand how different layers interact and the roles of client-side and server-side code.

    More Like This

    Use Quizgecko on...
    Browser
    Browser