CSC/ECE 517 Spring 2024 - E2415. Reimplement responses controller.rb

From Expertiza_Wiki
Revision as of 21:48, 19 March 2024 by Mmoyape (talk | contribs) (Created page with "= Project E2415: Refactoring ResponsesController in Expertiza = This wiki page documents the enhancements and modifications made to the ResponsesController in the Expertiza system during the Spring 2022 CSC/ECE 517 course. == Team == === Team Members === [Maday Moya] [Deana Frank] [Jacob Leavitt] === Links === Pull request: [ ] GitHub repo: [https://github.com/dlfranks/reimplementation-back-end] Deployed server: [] Credentials: user...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Project E2415: Refactoring ResponsesController in Expertiza

This wiki page documents the enhancements and modifications made to the ResponsesController in the Expertiza system during the Spring 2022 CSC/ECE 517 course.

Team

Team Members

   [Maday Moya]
   [Deana Frank]
   [Jacob Leavitt]

Links

   Pull request: [ ]
   GitHub repo: [1]
   Deployed server: []
       Credentials: username - [], password - []

Introduction

Expertiza is an open-source web application developed in Ruby on Rails, facilitating peer reviews, team formations, and various assignment functionalities within educational settings. Despite its comprehensive features, certain components of the application, such as the ResponsesController, required updates to enhance maintainability, adhere to Rails conventions, and improve functionality.

Problem Statement

The existing ResponseController deviates from standard Rails conventions by using a singular name and encompassing numerous responsibilities beyond CRUD operations. Our reimplementation aims to:

   Rename the controller to ResponsesController in line with Rails naming conventions.
   Reduce the controller's size by relocating non-CRUD logic.
   Retain up-to-date authentication and authorization methods.
   Implement polymorphism to eliminate type checking for the reviewer entity.
   Simplify parameter-setting methods to streamline object accessibility.
   Create and manage Response objects, including associated Answer objects for each rubric item.

Solutions

Our team tackled these issues as follows:

Adherence to Rails Naming Conventions

The controller was renamed to ResponsesController, with all references updated accordingly to maintain consistency across the application.

Refactoring for Simplification and Maintainability

   Methods not directly related to CRUD operations were moved to more appropriate locations within the application, such as models or helpers, to streamline the controller.
   The questionnaire_from_response_map method was broken down into smaller, more manageable methods, each handling a specific part of the logic.
   Email-related functionalities were consolidated into a helper module, allowing for reuse across the application and reducing duplication.

Implementation of Polymorphism

We introduced polymorphism to handle different types of responses more efficiently, removing the need for cumbersome if-else statements and enhancing the code's readability and maintainability.

Challenges and Learning Outcomes

The project presented several challenges, particularly in refactoring complex methods and introducing polymorphism. Through this process, our team learned advanced Rails development techniques, improved our ability to work with legacy code, and gained a deeper understanding of the Expertiza application's architecture.

Conclusion

The refactoring of the ResponsesController has made the code more maintainable, aligned with Rails conventions, and prepared the application for future enhancements. This project has not only improved the functionality of Expertiza but also provided our team with valuable experience in working with open-source software.