Software Design and Testing Overview
48 Questions
1 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 role of the Model in the MVC pattern?

  • Rendering the user interface
  • Invoking business logic
  • Handling user events
  • Persisting domain data (correct)
  • Which component of the MVC pattern is responsible for responding to HTTP requests?

  • Controller (correct)
  • Model
  • View
  • Service
  • What are the three elements included in the Model?

  • Entities, Controllers, Services
  • Entities, Services, Repositories (correct)
  • Models, Views, Repositories
  • Repositories, Views, Services
  • What is the purpose of a Repository in the MVC pattern?

    <p>To save and retrieve domain objects</p> Signup and view all the answers

    What do entities in the model represent?

    <p>Domain objects with unique identities</p> Signup and view all the answers

    How are repositories typically organized in MVC?

    <p>One repository per entity</p> Signup and view all the answers

    What functionality do services provide in the MVC pattern?

    <p>APIs for domain functionality</p> Signup and view all the answers

    Which statement is true regarding JPA Entities?

    <p>They are mapped to tables in the database.</p> Signup and view all the answers

    What does the acronym DRY stand for in design principles?

    <p>Don't Repeat Yourself</p> Signup and view all the answers

    Which principle suggests avoiding unnecessary complexity in design?

    <p>Keep It Simple, Stupid</p> Signup and view all the answers

    What is the main idea behind the YAGNI principle?

    <p>Only implement features when they are actually needed.</p> Signup and view all the answers

    Which of the following best describes 'Information Hiding'?

    <p>Modules should hide information that is not needed by others.</p> Signup and view all the answers

    What does Separation of Concerns refer to in software design?

    <p>Dividing a system into components with a single responsibility.</p> Signup and view all the answers

    How can decomposing a problem be described?

    <p>Dividing a problem into smaller, more manageable parts.</p> Signup and view all the answers

    What is a key benefit of following the KISS principle?

    <p>Reduced likelihood of system errors.</p> Signup and view all the answers

    Which statement is true about the iterative nature of design?

    <p>Iterative design allows for continuous improvement.</p> Signup and view all the answers

    What is the default user and password for accessing the database console?

    <p>sa / no password</p> Signup and view all the answers

    Which property in the application configuration allows changing the backend server port?

    <p>server.port</p> Signup and view all the answers

    Where are the static resources served by the node development server located?

    <p>frontend/src/static</p> Signup and view all the answers

    What happens when a Java file is changed in the IDE?

    <p>The backend server automatically restarts.</p> Signup and view all the answers

    In the Model View Controller (MVC) pattern, what does the 'Model' represent?

    <p>Data and business logic.</p> Signup and view all the answers

    Which component of the MVC pattern is responsible for responding to user interface events?

    <p>Controller</p> Signup and view all the answers

    What is the purpose of running 'mvnw install' for a Spring Boot application?

    <p>It downloads necessary libraries for the application.</p> Signup and view all the answers

    What happens to the H2 database each time the Spring Boot application starts?

    <p>It is created and populated anew.</p> Signup and view all the answers

    What should you do after changing the backend port in application properties?

    <p>Also update the frontend code to reflect the new port.</p> Signup and view all the answers

    Which command is used to run the application as a Java app directly from the IDE?

    <p>Run as → Java application</p> Signup and view all the answers

    How do changes in frontend jsx/js files affect the server during development?

    <p>The frontend server automatically refreshes.</p> Signup and view all the answers

    Which front-end command is used to start the application?

    <p>npm start</p> Signup and view all the answers

    What architectural choice is made for the APIs in the described application?

    <p>Monolithic architecture</p> Signup and view all the answers

    What is a requirement in the development environment to avoid weird errors?

    <p>Lombok</p> Signup and view all the answers

    What type of server is only used during development for hot reloading?

    <p>Development server</p> Signup and view all the answers

    What content does the backend of the application serve to the frontend after an HTTP request?

    <p>HTML, CSS, and JavaScript</p> Signup and view all the answers

    What is a key characteristic of a Single Page Application (SPA)?

    <p>Only a single HTML page is loaded and dynamically updated.</p> Signup and view all the answers

    Which of the following is NOT an advantage of a Single Page Application?

    <p>Long initial wait time</p> Signup and view all the answers

    What is a disadvantage associated with Single Page Applications?

    <p>They present SEO challenges for discoverability.</p> Signup and view all the answers

    Which JavaScript frameworks are often associated with Single Page Applications?

    <p>Angular, React, and Vue.js</p> Signup and view all the answers

    What type of architecture does Spring Boot support for microservices?

    <p>Microservices architecture</p> Signup and view all the answers

    How does a Single Page Application typically reduce the size of the response payload?

    <p>By returning only JSON data instead of complete HTML.</p> Signup and view all the answers

    What is a necessary component for integrating a SPA with microservices using Spring Boot?

    <p>A modern JavaScript framework like React or Angular</p> Signup and view all the answers

    Which of the following statements about Single Page Applications is accurate?

    <p>They involve a longer initial loading time compared to traditional applications.</p> Signup and view all the answers

    What is the primary purpose of design patterns?

    <p>To provide tools for creating flexible and maintainable designs</p> Signup and view all the answers

    Which statement correctly describes a library?

    <p>It provides reusable code that can be used by application developers.</p> Signup and view all the answers

    Which of the following is NOT a characteristic of frameworks?

    <p>They include specific functionality related to the application's purpose.</p> Signup and view all the answers

    How do libraries and frameworks differ in their usage?

    <p>Frameworks allow more architectural decisions to be made by the developer than libraries.</p> Signup and view all the answers

    Which of the following is a feature of frameworks?

    <p>They usually provide a set of common functionalities.</p> Signup and view all the answers

    What must a developer consider when selecting a framework?

    <p>The framework should meet the developer's choice of architectural style.</p> Signup and view all the answers

    Which example correctly illustrates a library?

    <p>Math.lib for mathematical functions.</p> Signup and view all the answers

    What is often true about the architectural decisions in a framework?

    <p>Most decisions are left to the developer.</p> 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

    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.

    Quiz Team

    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.

    More Like This

    User Interface Design and IDEs
    10 questions
    Key Components in Software Design
    37 questions
    Use Quizgecko on...
    Browser
    Browser