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?
- 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?
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);'
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?
What method is used to retrieve a double value from a JSONArray?
What is the primary focus of Bottom-Up integration testing?
What is the primary focus of Bottom-Up integration testing?
What is a significant disadvantage of Bottom-Up integration testing?
What is a significant disadvantage of Bottom-Up integration testing?
What is one of the main benefits of using Sandwich integration testing?
What is one of the main benefits of using Sandwich integration testing?
What do stubs simulate in integration testing?
What do stubs simulate in integration testing?
How do drivers function in integration testing?
How do drivers function in integration testing?
Why might Bottom-Up integration testing be considered complex?
Why might Bottom-Up integration testing be considered complex?
Which scenario exemplifies the use of a stub in integration testing?
Which scenario exemplifies the use of a stub in integration testing?
What challenge does Sandwich integration testing often face?
What challenge does Sandwich integration testing often face?
What is the primary focus of a controller in software architecture?
What is the primary focus of a controller in software architecture?
Which of the following is an advantage of the monolith architecture?
Which of the following is an advantage of the monolith architecture?
How does integration testing primarily differ from unit and system testing?
How does integration testing primarily differ from unit and system testing?
What is a drawback of Big-Bang integration testing?
What is a drawback of Big-Bang integration testing?
What is one of the primary benefits of Top-Down integration testing?
What is one of the primary benefits of Top-Down integration testing?
Which statement best describes microservices architecture?
Which statement best describes microservices architecture?
What is a potential disadvantage of using microservices?
What is a potential disadvantage of using microservices?
What does unit testing specifically test?
What does unit testing specifically test?
What is the primary function of the @Mock annotation in Mockito?
What is the primary function of the @Mock annotation in Mockito?
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?
How do you verify that a function was called exactly once?
How do you verify that a function was called exactly once?
What is the purpose of the lenient() method in Mockito?
What is the purpose of the lenient() method in Mockito?
What does data persistence refer to?
What does data persistence refer to?
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?
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?
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?
What is the main characteristic of the Client-Server architectural pattern?
What is the main characteristic of the Client-Server architectural pattern?
What characterizes a JSONObject in JSON syntax?
What characterizes a JSONObject in JSON syntax?
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?
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?
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?
What defines server-side code in contrast to client-side code?
What defines server-side code in contrast to client-side code?
What does each layer in the Three-Layer Architecture provide?
What does each layer in the Three-Layer Architecture provide?
How does the MVC architecture differ from the Three-Layer Architecture?
How does the MVC architecture differ from the Three-Layer Architecture?
Flashcards
Software Architecture
Software Architecture
A general framework or approach used to build a software product, similar to a design pattern.
Module
Module
Smaller, reusable units of code that perform specific tasks, often within a larger component.
Component
Component
Larger, more complex units of code that combine multiple modules to provide a more comprehensive functionality.
Client-Server Architecture
Client-Server Architecture
Signup and view all the flashcards
Client-Side Code
Client-Side Code
Signup and view all the flashcards
Monolith architecture
Monolith architecture
Signup and view all the flashcards
Server-Side Code
Server-Side Code
Signup and view all the flashcards
Microservice architecture
Microservice architecture
Signup and view all the flashcards
Three-Layer Architecture
Three-Layer Architecture
Signup and view all the flashcards
Integration testing
Integration testing
Signup and view all the flashcards
MVC Architecture (Model-View-Controller)
MVC Architecture (Model-View-Controller)
Signup and view all the flashcards
Big-Bang integration testing
Big-Bang integration testing
Signup and view all the flashcards
Top-Down integration testing
Top-Down integration testing
Signup and view all the flashcards
Unit testing
Unit testing
Signup and view all the flashcards
System testing
System testing
Signup and view all the flashcards
Controller's role in UI
Controller's role in UI
Signup and view all the flashcards
Mockito's @Mock Annotation
Mockito's @Mock Annotation
Signup and view all the flashcards
Mockito's mock(ClassName.class)
Mockito's mock(ClassName.class)
Signup and view all the flashcards
Mockito's when(mockObject.function()).thenReturn(returnObject)
Mockito's when(mockObject.function()).thenReturn(returnObject)
Signup and view all the flashcards
Mockito's verify(mockObject, times(1)).function()
Mockito's verify(mockObject, times(1)).function()
Signup and view all the flashcards
Mockito's verify(mockObject, times(0)).function() OR verify(mockObject, never()).function()
Mockito's verify(mockObject, times(0)).function() OR verify(mockObject, never()).function()
Signup and view all the flashcards
Mockito's lenient()
Mockito's lenient()
Signup and view all the flashcards
Data Persistence
Data Persistence
Signup and view all the flashcards
JSON (JavaScript Object Notation)
JSON (JavaScript Object Notation)
Signup and view all the flashcards
What is a JSONArray?
What is a JSONArray?
Signup and view all the flashcards
JSON numbers
JSON numbers
Signup and view all the flashcards
JSON strings
JSON strings
Signup and view all the flashcards
JSON booleans
JSON booleans
Signup and view all the flashcards
Building a JSONObject
with a list
Building a JSONObject
with a list
Signup and view all the flashcards
Bottom-Up Integration Testing
Bottom-Up Integration Testing
Signup and view all the flashcards
Sandwich Integration Testing
Sandwich Integration Testing
Signup and view all the flashcards
Stubs
Stubs
Signup and view all the flashcards
Drivers
Drivers
Signup and view all the flashcards
Trace Fault Responsibility
Trace Fault Responsibility
Signup and view all the flashcards
Against Abstractions
Against Abstractions
Signup and view all the flashcards
Combined Benefits (Sandwich)
Combined Benefits (Sandwich)
Signup and view all the flashcards
Difficult Implementation (Sandwich)
Difficult Implementation (Sandwich)
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
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.