CSC/ECE 517 Spring 2024 - E2407 Refactor review mapping controller.rb

From Expertiza_Wiki
Revision as of 03:11, 23 March 2024 by Lpatel (talk | contribs)
Jump to navigation Jump to search

This wiki page describes changes made under the E2407 OODD assignment for Spring 2024, CSC/ECE 517.

Expertiza Background

Expertiza is an open-source initiative that educators and students at NCSU create and manage. It contains several features that facilitate teacher-student interactions and is built on the Ruby on Rails architecture. Teachers can set homework and grade student submissions. Students organize into groups, turn in assignments, and evaluate the work of their colleagues.


[ Link to the Pull Request Submitted]
[ Link to the deployed project]
[ Link to the Repository]

Functionality of review_mapping_controller

Review_mapping_controller's function is to supply reviewer and assignment mapping. In essence, the controller manages the assignment of reviews, such as peer and self-reviews, to several teams or to a single student user. Following assignment policy, this controller is also in charge of responding to requests from students for additional bonus evaluations.


Problem Statement

The review_mapping_controller is a long and complex file. Most of the methods are sparsely commented on. Some methods are way too long to understand, please break them down into pieces for better understanding. Also, the few instances of code duplication that exist should also be removed.

Tasks

-Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping, peer_review_strategy, etc. -Rename variable names to convey what they are used for.
-Replace switch statements with subclasses methods.
-Create models for the subclasses.
-Remove hardcoded parameters.
-Add meaningful comments and edit/remove/do not unnecessary comments.
-Try to increase the test coverage.
-

Design Pattern

We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.