Podcast
Questions and Answers
What is the primary role of the Model in the MVC pattern?
What is the primary role of the Model in the MVC pattern?
Which component of the MVC pattern is responsible for responding to HTTP requests?
Which component of the MVC pattern is responsible for responding to HTTP requests?
What are the three elements included in the Model?
What are the three elements included in the Model?
What is the purpose of a Repository in the MVC pattern?
What is the purpose of a Repository in the MVC pattern?
Signup and view all the answers
What do entities in the model represent?
What do entities in the model represent?
Signup and view all the answers
How are repositories typically organized in MVC?
How are repositories typically organized in MVC?
Signup and view all the answers
What functionality do services provide in the MVC pattern?
What functionality do services provide in the MVC pattern?
Signup and view all the answers
Which statement is true regarding JPA Entities?
Which statement is true regarding JPA Entities?
Signup and view all the answers
What does the acronym DRY stand for in design principles?
What does the acronym DRY stand for in design principles?
Signup and view all the answers
Which principle suggests avoiding unnecessary complexity in design?
Which principle suggests avoiding unnecessary complexity in design?
Signup and view all the answers
What is the main idea behind the YAGNI principle?
What is the main idea behind the YAGNI principle?
Signup and view all the answers
Which of the following best describes 'Information Hiding'?
Which of the following best describes 'Information Hiding'?
Signup and view all the answers
What does Separation of Concerns refer to in software design?
What does Separation of Concerns refer to in software design?
Signup and view all the answers
How can decomposing a problem be described?
How can decomposing a problem be described?
Signup and view all the answers
What is a key benefit of following the KISS principle?
What is a key benefit of following the KISS principle?
Signup and view all the answers
Which statement is true about the iterative nature of design?
Which statement is true about the iterative nature of design?
Signup and view all the answers
What is the default user and password for accessing the database console?
What is the default user and password for accessing the database console?
Signup and view all the answers
Which property in the application configuration allows changing the backend server port?
Which property in the application configuration allows changing the backend server port?
Signup and view all the answers
Where are the static resources served by the node development server located?
Where are the static resources served by the node development server located?
Signup and view all the answers
What happens when a Java file is changed in the IDE?
What happens when a Java file is changed in the IDE?
Signup and view all the answers
In the Model View Controller (MVC) pattern, what does the 'Model' represent?
In the Model View Controller (MVC) pattern, what does the 'Model' represent?
Signup and view all the answers
Which component of the MVC pattern is responsible for responding to user interface events?
Which component of the MVC pattern is responsible for responding to user interface events?
Signup and view all the answers
What is the purpose of running 'mvnw install' for a Spring Boot application?
What is the purpose of running 'mvnw install' for a Spring Boot application?
Signup and view all the answers
What happens to the H2 database each time the Spring Boot application starts?
What happens to the H2 database each time the Spring Boot application starts?
Signup and view all the answers
What should you do after changing the backend port in application properties?
What should you do after changing the backend port in application properties?
Signup and view all the answers
Which command is used to run the application as a Java app directly from the IDE?
Which command is used to run the application as a Java app directly from the IDE?
Signup and view all the answers
How do changes in frontend jsx/js files affect the server during development?
How do changes in frontend jsx/js files affect the server during development?
Signup and view all the answers
Which front-end command is used to start the application?
Which front-end command is used to start the application?
Signup and view all the answers
What architectural choice is made for the APIs in the described application?
What architectural choice is made for the APIs in the described application?
Signup and view all the answers
What is a requirement in the development environment to avoid weird errors?
What is a requirement in the development environment to avoid weird errors?
Signup and view all the answers
What type of server is only used during development for hot reloading?
What type of server is only used during development for hot reloading?
Signup and view all the answers
What content does the backend of the application serve to the frontend after an HTTP request?
What content does the backend of the application serve to the frontend after an HTTP request?
Signup and view all the answers
What is a key characteristic of a Single Page Application (SPA)?
What is a key characteristic of a Single Page Application (SPA)?
Signup and view all the answers
Which of the following is NOT an advantage of a Single Page Application?
Which of the following is NOT an advantage of a Single Page Application?
Signup and view all the answers
What is a disadvantage associated with Single Page Applications?
What is a disadvantage associated with Single Page Applications?
Signup and view all the answers
Which JavaScript frameworks are often associated with Single Page Applications?
Which JavaScript frameworks are often associated with Single Page Applications?
Signup and view all the answers
What type of architecture does Spring Boot support for microservices?
What type of architecture does Spring Boot support for microservices?
Signup and view all the answers
How does a Single Page Application typically reduce the size of the response payload?
How does a Single Page Application typically reduce the size of the response payload?
Signup and view all the answers
What is a necessary component for integrating a SPA with microservices using Spring Boot?
What is a necessary component for integrating a SPA with microservices using Spring Boot?
Signup and view all the answers
Which of the following statements about Single Page Applications is accurate?
Which of the following statements about Single Page Applications is accurate?
Signup and view all the answers
What is the primary purpose of design patterns?
What is the primary purpose of design patterns?
Signup and view all the answers
Which statement correctly describes a library?
Which statement correctly describes a library?
Signup and view all the answers
Which of the following is NOT a characteristic of frameworks?
Which of the following is NOT a characteristic of frameworks?
Signup and view all the answers
How do libraries and frameworks differ in their usage?
How do libraries and frameworks differ in their usage?
Signup and view all the answers
Which of the following is a feature of frameworks?
Which of the following is a feature of frameworks?
Signup and view all the answers
What must a developer consider when selecting a framework?
What must a developer consider when selecting a framework?
Signup and view all the answers
Which example correctly illustrates a library?
Which example correctly illustrates a library?
Signup and view all the answers
What is often true about the architectural decisions in a framework?
What is often true about the architectural decisions in a framework?
Signup and view all the answers
Study Notes
Introduction to Software Design and Testing
- Introduction to Software Design and Testing, Design & Tests 1, E.T.S. de Ingeniería Informática, UNIVERSIDAD DE SEVILLA
Topics for Software Design KA
- Software Design Fundamentals
- Key Issues in Software Design
- Software Structure and Architecture
- User Interface Design
- Software Design Quality Analysis and Evaluation
- Software Design Notations
- Software Design Strategies and Methods
- Software Design Tools
- General Design Concepts
- Concurrency
- Architectural Structures and Viewpoints
- General User Interface Design Principles
- Quality Attributes
- Software Design Process
- Data persistence
- Architectural Styles
- Design Patterns
- The Design of User Interaction Modalities
- The Design of Information Presentation
- User Interface Design Process
- Interaction and Presentation
- Localization and Internationalization
- Metaphors and Conceptual Models
- Relationship of Testing to Other Activities
- Key Issues
- Objectives of Testing
- Error and Exception Handling and Fault Tolerance
- Families of Programs and Frameworks
- Code-Based Techniques
- Fault-Based Techniques
- Usage-Based Techniques
- Model-Based Techniques
- Techniques Based on the Nature of the Application
- Selecting and Combining Techniques
- Practical Considerations
- Testing Tool Support
- Test Activities
- Categories of Tools
Design Concepts
- Main concepts around design
- Why is software design important
- Frameworks & Design Patterns
- Design of our architecture (a Spring Boot Application with Spring MVC)
- MVC in Spring
- Services
- Entities
- Repositories
- Spring controllers
- React Views
- Overview of a Spring Boot Application
- MVC in Spring
Software Design vs Software Requirements
- Software requirements define "what" your system needs to do.
- Software Design defines "how" to create a system that meets those requirements.
Design Decisions
- How many modules should the system have?
- Should we use a layered architecture or pipes and filters/microservices architecture/etc.?
- Which class should implement this method/functionality?
- This constraint should be implemented in the services layer/business logic or as a constraint in the DB (maybe using triggers)?
Design is a "wicked" problem
- There is no definitive/unambiguous/analytical formulation.
- Solutions are not right or totally wrong, but better/worse.
- There is no stopping rule, i.e., we do not know when have we found the best possible solution, we only know if we have found a good enough solution (by now).
Cruft
- Any software system has a certain amount of essential complexity required to do its job...
- ...but most systems contain cruft that makes it harder to understand.
- Cruft causes changes to take more effort.
Impact of Cruft
- The cruft means new features take longer to build.
- This extra time and effort is the cost of the cruft, paid with each new feature.
- Free of cruft, features can be added more quickly.
Software Design
- The process of defining the architecture, components, interfaces, and other characteristics of a system or component (and the result of that process).
Design principles
- Don't Repeat Yourself (DRY)
- Keep It Simple, Stupid! (KISS)
- You Aren't Gonna Need It (YAGNI)
- Separation of concerns: each element of the system has a single responsibility
- Decomposition: Divide the problems into simpler/smaller problems (Divide & Conquer)
- Information hiding: Design modules so that the information (algorithms and data) contained in a module is inaccessible to those who do not need it
- Protected variations: Trying to hide / protect changes to the rest of the system
- Cohesion: It is a qualitative indicator of the degree to which a module focuses on doing one thing
- Coupling: Is a qualitative indicator of the degree to which a module is connected to others and the outside world
- Design patterns: A pattern is a general solution to a recurring design problem
- Libraries
- Frameworks
The Power of Design Patterns
- Design Patterns give you a shared vocabulary with other developers.
- Patterns allow you to say more with less.
- Design patterns also elevate your thinking about software, by letting you think at the pattern level, not the nitty-gritty object/ or source code level.
- Design patterns are tools for Design Toolbox, that allow you to create flexible designs that are maintainable and can cope with change
MVC Pattern
- Architectural pattern that structures an application in three different components.
- Model
- View
- Controller
- Model: It is the representation of the information. It includes both the data and the business logic that is necessary to work with them.
- View: It is the presentation of the model in a way the user can interact with it.
- Controller: It responds to events in the user interface (HTTP requests ), invokes changes in the model, and, probably, in the view.
Model
- Entities
- Repositories
- Services
Entities
- A domain object whose data is persisted in the database and has its own identity.
- In the example they all inherit from a class (BaseEntity).
- They have annotations that indicate how to map attributes to tables in the database.
- They are JPA Entities
Repositories
- It provides methods for retrieving and saving domain objects to the database.
- There is usually one repository per entity.
- In the example, they are done in two different levels of interfaces.
- We try to have a repository per entity.
Services
- They expose the functionality of the domain as an API.
- The are usually organized in terms of entities.
- They should perform domain-related validation, but not input-related validation, which is placed in the controller.
- As a rule of thumb, they should not include validation that could be performed using client-side Javascript.
- They should include annotation @Transactional if they involve saving/modifying/deleting something into the database.
Controllers in Spring
- They respond to events in the user interface (HTTP requests).
- Invokes changes in the model, and return data to the view as JSON.
- Spring provides a way to map an HTTP request to a method by annotating them with @GetMapping or @PostMapping.
- RESTful Controllers are responsible for:
- Validating the input provided by the views (only input-related validation)
- Transforming this input into entities if necessary
- Calling services
- Return the app
Views
- Views represent the information provided by the controller.
- Spring MVC is view agnostic.
- This enables the integration of SPA frameworks.
- In our project we will use React and JSX components to create Views.
Security
- Security configuration
- Configuration for backend server
- Static resources
Architecture of a Spring Boot web application
Single Page Application (SPA)
- A web application that has only one page loaded in the browser and is not reloaded during use.
- When users interact with the page, the application dynamically rewrites/updates the current page rather than loading a new page from the server.
- Since the HTML is rendered client-side, the payload is decreased as the server only returns JSON and not HTML.
Advantages of SPA
- Fast and fluid response time
- Simple to build and debug
- Smooth transition to mobile development
- Good integration with layers and microservices architectures
Disadvantages of SPA
- Long initial wait time
- You still need to wait for data
- Requires specific javascript frameworks
- SEO implications
Spring Boot integration
- Spring boot is the most popular framework for microservices development in Java.
- To implement a SPA as global presentation layer for the microservices you need to integrate a modern javascript framework like Angular, or React, etc.
- Our APIs are deployed as a monolith.
Launching and Debugging
- Download libraries via Maven - Install (or mvnw install)
- Install Lombok in your development environment
- Launch PetclinicApplication as a regular Java app
- Debug is exactly the same as launching the app, just choose the debug option from the IDE
- On the frontend folder use npm start
- Access the application at http://localhost:3000
HTTP + URIs + AJAX
- Frontend (React JS) makes HTTP requests
- HTML + JS + CSS
- Backend (Spring Boot) processes requests
- Queries to the database
- Sending back a response in JSON format
About the database
- Uses in-memory database called H2
- Created and populated each time the app starts
- Modification files for initial population
About the servers
- Uses embeded Tomcat server for backend
- a node development server for the frontend
- Modification of the application.properties file to change ports
One additional remark
- Eclipse (and other IDEs) usually recompiles automatically every java file you change.
- Backend server restarts when a change is detected.
- No need to restart the app when making changes.
- Frontend changes, you don't need to stop the frontend server manually.
- Use of a dedicated development server.
Reminders
- Reminders are specific to the project, outlining deadlines.
References
- References to specific books.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz covers fundamental concepts in software design and testing, focusing on various key issues, strategies, and evaluation methods. You will explore user interface design principles, architectural structures, and quality attributes crucial for effective software development. Dive deep into the practices that enhance software quality and usability.