Software Architecture Overview

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

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() (D)</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 (B)</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 (C)</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 (B)</p> Signup and view all the answers

What do stubs simulate in integration testing?

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

How do drivers function in integration testing?

<p>They call lower-level modules that are missing (A)</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 (D)</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 (D)</p> Signup and view all the answers

What challenge does Sandwich integration testing often face?

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

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

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

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

<p>Lower server costs (D)</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. (A)</p> Signup and view all the answers

What is a drawback of Big-Bang integration testing?

<p>It is challenging to trace faults. (D)</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. (D)</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. (B)</p> Signup and view all the answers

What is a potential disadvantage of using microservices?

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

What does unit testing specifically test?

<p>An individual unit of the system. (D)</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. (C)</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); (A)</p> Signup and view all the answers

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

<p>verify(mockObject, times(1)).function(); (B)</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. (C)</p> Signup and view all the answers

What does data persistence refer to?

<p>Data that remains beyond the current execution of the program. (A)</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 (C)</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. (C)</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. (B)</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. (B)</p> Signup and view all the answers

What characterizes a JSONObject in JSON syntax?

<p>It contains key-value mappings. (D)</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. (B)</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 (A)</p> Signup and view all the answers

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

<p>Functions and classes (A)</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. (D)</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 (C)</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. (A)</p> Signup and view all the answers

Flashcards

Software Architecture

A general framework or approach used to build a software product, similar to a design pattern.

Module

Smaller, reusable units of code that perform specific tasks, often within a larger component.

Component

Larger, more complex units of code that combine multiple modules to provide a more comprehensive functionality.

Client-Server Architecture

A common architectural pattern that separates functionality into two distinct components, a centralized server and multiple clients.

Signup and view all the flashcards

Client-Side Code

Code that runs on the user's device, interacting directly with the user interface.

Signup and view all the flashcards

Monolith architecture

A software architecture where all code is bundled into a single application and deployed as one unit.

Signup and view all the flashcards

Server-Side Code

Code that runs on a remote server, handling tasks and processing data, then sending results back to the client.

Signup and view all the flashcards

Microservice architecture

A software architecture that breaks down an application into smaller, independent services that communicate over a network.

Signup and view all the flashcards

Three-Layer Architecture

A popular architectural pattern that separates a software application into three distinct layers: Presentation, Business Logic, and Data.

Signup and view all the flashcards

Integration testing

Testing that verifies the interaction between different units of a system, such as modules or components.

Signup and view all the flashcards

MVC Architecture (Model-View-Controller)

A layered architecture that focuses on the user interface (View), data manipulation (Model), and user interactions (Controller).

Signup and view all the flashcards

Big-Bang integration testing

A strategy of integration testing where all components are combined at once without a specific order.

Signup and view all the flashcards

Top-Down integration testing

A strategy of integration testing that starts with the top-level modules (e.g., UI) and gradually integrates lower-level components.

Signup and view all the flashcards

Unit testing

Testing that focuses on individual units of code, such as functions or classes.

Signup and view all the flashcards

System testing

Testing that verifies the functionality of the complete system, typically performed after integration testing.

Signup and view all the flashcards

Controller's role in UI

The interaction between the user interface (UI) and the underlying logic of the application.

Signup and view all the flashcards

Mockito's @Mock Annotation

Mockito annotation to create mock objects as instance variables.

Signup and view all the flashcards

Mockito's mock(ClassName.class)

A function in Mockito for creating mock objects on the fly.

Signup and view all the flashcards

Mockito's when(mockObject.function()).thenReturn(returnObject)

Mockito function for defining return values for mock object functions. Specifies the expected output for a given mock object function call.

Signup and view all the flashcards

Mockito's verify(mockObject, times(1)).function()

Mockito function for verifying if a function was called.

Signup and view all the flashcards

Mockito's verify(mockObject, times(0)).function() OR verify(mockObject, never()).function()

Mockito function for verifying if a function wasn't called.

Signup and view all the flashcards

Mockito's lenient()

Mockito's lenient approach to handling unused when-then calls, useful for maps and sets with conditional execution.

Signup and view all the flashcards

Data Persistence

Data stored and available between different program executions.

Signup and view all the flashcards

JSON (JavaScript Object Notation)

A standard format for representing structured data as key-value pairs. Used frequently in data exchange and storage.

Signup and view all the flashcards

What is a JSONArray?

A JSONArray is a structured collection of data where each element is a valid JSON type. Think of it as a list of items that can be numbers, strings, booleans, other JSONArrays, or JSONObjects.

Signup and view all the flashcards

JSON numbers

JSON numbers can represent both integers and floating-point values. They are used to represent numerical data in a JSON document.

Signup and view all the flashcards

JSON strings

JSON strings are used to represent textual data. They are enclosed in double quotes and can include various characters, including letters, numbers, and special characters.

Signup and view all the flashcards

JSON booleans

JSON booleans are used to represent truth values, either true or false. They are used to indicate logical conditions in a JSON document.

Signup and view all the flashcards

Building a JSONObject with a list

JSON objects can be built using Java by using the JSONObject class and its put method. When you put a list into a JSONObject, it is automatically converted to a JSONArray behind the scenes.

Signup and view all the flashcards

Bottom-Up Integration Testing

A testing approach where you start with low-level modules (e.g., database interactions) and gradually integrate them with higher-level modules, testing as you go.

Signup and view all the flashcards

Sandwich Integration Testing

A testing approach where you start with a middle layer, integrate modules above it using Bottom-Up, and integrate modules below it using Top-Down.

Signup and view all the flashcards

Stubs

Modules that simulate the behavior of missing or incomplete modules during integration testing. They provide fake outputs without replicating internal states.

Signup and view all the flashcards

Drivers

Modules that simulate parts of a higher-level module to enable testing of lower-level modules during integration testing.

Signup and view all the flashcards

Trace Fault Responsibility

A benefit of Bottom-Up integration testing is that it simplifies identifying the source of errors. If a test fails, you know the fault lies in the recently integrated module.

Signup and view all the flashcards

Against Abstractions

A drawback of Bottom-Up Integration testing is that it goes against the usual design pattern of starting with abstractions (interfaces) and then implementing them.

Signup and view all the flashcards

Combined Benefits (Sandwich)

A benefit of Sandwich Integration testing is that it combines the advantages of both Bottom-Up and Top-Down approaches. It's flexible and well-suited for complex systems.

Signup and view all the flashcards

Difficult Implementation (Sandwich)

A drawback of Sandwich Integration testing is that choosing the 'middle' layer can be tricky, and implementing it requires a variety of skills.

Signup and view all the flashcards

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

More Like This

Architecture Client/Serveur - Partie 1
10 questions
Client Server Computing Flashcards
8 questions

Client Server Computing Flashcards

BenevolentDramaticIrony avatar
BenevolentDramaticIrony
Distributed Systems Architectures
30 questions
Architectural Styles and Design Patterns
10 questions
Use Quizgecko on...
Browser
Browser