Podcast
Questions and Answers
What is the primary difference between a JSONArray and a JSONObject?
What is the primary difference between a JSONArray and a JSONObject?
Which value is not a valid type to use inside a JSONObject?
Which value is not a valid type to use inside a JSONObject?
Will the following code work for adding a list to a JSONObject? 'jsonObject.put("someList", list);'
Will the following code work for adding a list to a JSONObject? 'jsonObject.put("someList", list);'
What method is used to retrieve a double value from a JSONArray?
What method is used to retrieve a double value from a JSONArray?
Signup and view all the answers
What is the primary focus of Bottom-Up integration testing?
What is the primary focus of Bottom-Up integration testing?
Signup and view all the answers
What is a significant disadvantage of Bottom-Up integration testing?
What is a significant disadvantage of Bottom-Up integration testing?
Signup and view all the answers
What is one of the main benefits of using Sandwich integration testing?
What is one of the main benefits of using Sandwich integration testing?
Signup and view all the answers
What do stubs simulate in integration testing?
What do stubs simulate in integration testing?
Signup and view all the answers
How do drivers function in integration testing?
How do drivers function in integration testing?
Signup and view all the answers
Why might Bottom-Up integration testing be considered complex?
Why might Bottom-Up integration testing be considered complex?
Signup and view all the answers
Which scenario exemplifies the use of a stub in integration testing?
Which scenario exemplifies the use of a stub in integration testing?
Signup and view all the answers
What challenge does Sandwich integration testing often face?
What challenge does Sandwich integration testing often face?
Signup and view all the answers
What is the primary focus of a controller in software architecture?
What is the primary focus of a controller in software architecture?
Signup and view all the answers
Which of the following is an advantage of the monolith architecture?
Which of the following is an advantage of the monolith architecture?
Signup and view all the answers
How does integration testing primarily differ from unit and system testing?
How does integration testing primarily differ from unit and system testing?
Signup and view all the answers
What is a drawback of Big-Bang integration testing?
What is a drawback of Big-Bang integration testing?
Signup and view all the answers
What is one of the primary benefits of Top-Down integration testing?
What is one of the primary benefits of Top-Down integration testing?
Signup and view all the answers
Which statement best describes microservices architecture?
Which statement best describes microservices architecture?
Signup and view all the answers
What is a potential disadvantage of using microservices?
What is a potential disadvantage of using microservices?
Signup and view all the answers
What does unit testing specifically test?
What does unit testing specifically test?
Signup and view all the answers
What is the primary function of the @Mock annotation in Mockito?
What is the primary function of the @Mock annotation in Mockito?
Signup and view all the answers
What is the correct syntax to specify what a mocked function should return using Mockito?
What is the correct syntax to specify what a mocked function should return using Mockito?
Signup and view all the answers
How do you verify that a function was called exactly once?
How do you verify that a function was called exactly once?
Signup and view all the answers
What is the purpose of the lenient() method in Mockito?
What is the purpose of the lenient() method in Mockito?
Signup and view all the answers
What does data persistence refer to?
What does data persistence refer to?
Signup and view all the answers
What is the primary function of the presentation layer in the Three-Layer Architecture?
What is the primary function of the presentation layer in the Three-Layer Architecture?
Signup and view all the answers
In the context of software architecture, how would you differentiate between a component and a module?
In the context of software architecture, how would you differentiate between a component and a module?
Signup and view all the answers
Which of the following is NOT a common means to achieve data persistence?
Which of the following is NOT a common means to achieve data persistence?
Signup and view all the answers
What is the main characteristic of the Client-Server architectural pattern?
What is the main characteristic of the Client-Server architectural pattern?
Signup and view all the answers
What characterizes a JSONObject in JSON syntax?
What characterizes a JSONObject in JSON syntax?
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?
What happens if you use a Map with a guard clause and forget a when-then statement in Mockito?
Signup and view all the answers
Which layer in the MVC architecture is analogous to the Business Logic layer in the Three-Layer Architecture?
Which layer in the MVC architecture is analogous to the Business Logic layer in the Three-Layer Architecture?
Signup and view all the answers
In the context of software components, what does a module typically consist of?
In the context of software components, what does a module typically consist of?
Signup and view all the answers
What defines server-side code in contrast to client-side code?
What defines server-side code in contrast to client-side code?
Signup and view all the answers
What does each layer in the Three-Layer Architecture provide?
What does each layer in the Three-Layer Architecture provide?
Signup and view all the answers
How does the MVC architecture differ from the Three-Layer Architecture?
How does the MVC architecture differ from the Three-Layer Architecture?
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
andNOT 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.
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.