CSC/ECE 517 Spring 2024 - E2415. Reimplement responses controller.rb (Design Document): Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 8: Line 8:


==3.Design Goal==
==3.Design Goal==
The redesign of the `responses_controller.rb` is guided by several key objectives to improve the code quality, system behavior, and developer interaction. The goals include:
* **Maintainability and Scalability**: Ensuring the code is easy to understand, modify, and extend. The reimplementation should simplify future updates and feature additions.
* **Adherence to Rails Best Practices**: Following Rails conventions for naming, structure, and coding practices to ensure code consistency and reliability.
* **DRY Principle**: "Don't Repeat Yourself" - removing redundant code and logic to create a more efficient and error-resistant codebase.
* **Single Responsibility Principle**: Restructuring the controller and associated models so that each class and method has one purpose and one purpose only, leading to easier testing and management.
* **Improved Testing and Coverage**: Enhancing test suites to cover more scenarios and edge cases, increasing confidence in the application's stability and performance.
* **Performance Optimization**: Identifying and optimizing slow or inefficient areas in the code to ensure the application runs smoothly.
By meeting these design goals, the project aims to produce a `responses_controller.rb` that is robust, efficient, and a pleasure to work with, both for the current development team and for those who will maintain the system in the future.


==4.Class UML Diagram==
==4.Class UML Diagram==

Revision as of 21:43, 8 April 2024

CSC/ECE 517 Spring 2024 - E2415: Reimplementation of responses_controller.rb (Design Document)

1.Expertiza

The Expertiza project, an open-source endeavor rooted in Ruby on Rails, embarks on continuous improvement to adapt and integrate modern software engineering practices. The Responses Controller is engineered to assist reviewers in submitting structured data that is specifically aligned with an assignment's rubrics, ensuring the provision of relevant questions for each round within the correct due date period. It enables a reviewer to evaluate and score the rubric questions pertinent to the assignment's topics. Furthermore, it ensures the delivery of appropriate questions for each assignment round, allowing reviewers to create and modify scores and comments for each of the rubric questions associated with the assignment. After reviewers submit their scored questions and comments, the Responses Controller dispatches an email notification to the instructor and the reviewed team's members.

2.Problem Statement

The ResponseController in Expertiza, a legacy system with conventions predating Rails standards, is overly complex, encompassing functionalities beyond basic CRUD operations and needing adherence to modern Rails naming and design principles. Key issues include the direct implementation of functionalities like sorting reviews and checking reviewer roles within the controller, suggesting a shift towards polymorphism and a more structured approach to code organization. Furthermore, the controller's handling of email notifications and feedback mechanisms is inconsistent, indicating the necessity for a dedicated helper to streamline communication processes. The reimplementation effort must focus on simplifying the controller, adhering to Rails conventions, and improving code readability and maintainability by appropriately distributing responsibilities.

3.Design Goal

The redesign of the `responses_controller.rb` is guided by several key objectives to improve the code quality, system behavior, and developer interaction. The goals include:

  • **Maintainability and Scalability**: Ensuring the code is easy to understand, modify, and extend. The reimplementation should simplify future updates and feature additions.
  • **Adherence to Rails Best Practices**: Following Rails conventions for naming, structure, and coding practices to ensure code consistency and reliability.
  • **DRY Principle**: "Don't Repeat Yourself" - removing redundant code and logic to create a more efficient and error-resistant codebase.
  • **Single Responsibility Principle**: Restructuring the controller and associated models so that each class and method has one purpose and one purpose only, leading to easier testing and management.
  • **Improved Testing and Coverage**: Enhancing test suites to cover more scenarios and edge cases, increasing confidence in the application's stability and performance.
  • **Performance Optimization**: Identifying and optimizing slow or inefficient areas in the code to ensure the application runs smoothly.

By meeting these design goals, the project aims to produce a `responses_controller.rb` that is robust, efficient, and a pleasure to work with, both for the current development team and for those who will maintain the system in the future.

4.Class UML Diagram

5. Implementation

5.1 Model

Methods within the model were refactored or introduced, including:

  • 5.1.1 set_content
  • 5.1.2 validate_params
  • 5.1.3 serialize_response

5.2 Controller

Controller methods for CRUD operations were enhanced, comprising:

  • 5.2.1 Create
  • 5.2.2 Show
  • 5.2.3 Update
  • 5.2.4 Delete
  • 5.2.5 Questionnaire_from_response_map
  • 5.2.6 Questionnaire_from_response
  • 5.2.7 Create_answers
  • 5.2.8 Show_calibration_results_for_student
  • 5.2.9 Init_answers
  • 5.2.10 Save

6. Files Modified/Added

List of primary files modified or created includes:

  • responses_controller.rb
  • response_helper.rb
  • response.rb


7. Test Plan

Testing model methods

Test Coverage

8. Team

8.1 Mentor
  • Ameya Vaichalkar
8.2 Members
  • Jeff Riehle
  • Maday Moya
  • Jacob Leavitt

9. Links

Swagger Video Link:

Pull request:

Model Tests Video:

Controller Tests Video:

References