CSC/ECE 517 Spring 2024 - E2407 Refactor review mapping controller.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 26: Line 26:
-Try to increase the test coverage.<br/>
-Try to increase the test coverage.<br/>


For Phase 1 of the project we have focused working on the below mentioned issues.
For Phase 1 of the project we have focused working on the below mentioned issues.<br/>
-Refactor assign_reviewer_dynamically function<br/>
-Refactor assign_reviewer_dynamically function<br/>
-Corresponding changes to the tests for assign_reviewer_dynamically<br/>
-Corresponding changes to the tests for assign_reviewer_dynamically<br/>
Line 35: Line 35:
-Fixed Code climate issues<br/>
-Fixed Code climate issues<br/>


For Phase 2 of the project we plan working on the below mentioned issues.
For Phase 2 of the project we plan working on the below mentioned issues.<br/>
-Refactor automatic_review_mapping function<br/>
-Refactor automatic_review_mapping function<br/>
-Refactor peer_review_strategy function<br/>
-Refactor peer_review_strategy function<br/>

Revision as of 03:35, 24 March 2024

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

Expertiza Background

Ruby on Rails is used in the development of the open-source project Expertiza. The NC State staff and students are in charge of maintaining this online application. With this program, the teacher has total control over the tasks in their class. Expertiza is a feature-rich program that can manage any kind of assignment, with features like peer reviews, group creation, and subject addition. Go to the Expertiza wiki to find out more about all of the features that Expertiza offers.

About Controller

review_mapping_controller function is to map the reviewer to an assignment. In essence, the controller manages the distribution of reviews among various groups or individual student users, addressing situations such as peer and self-evaluations. Furthermore, the controller is essential in responding to student users' requests and enabling additional bonus reviews that comply with the assignment criteria.


Functionality of review_mapping_controller

The review_mapping_controller serves as a critical component within a system designed to manage the assignment mapping and allocation of reviewers for various types of assessments, such as peer reviews and self-assessments. Its primary function revolves around orchestrating the distribution of these reviews, whether they are assigned to multiple teams or to individual student users. This entails a sophisticated algorithmic process that takes into account factors such as fairness, diversity of perspectives, and adherence to assignment guidelines. By controlling the assignment of reviews, the controller ensures that each participant receives a balanced and constructive evaluation of their work, contributing to the overall integrity and effectiveness of the assessment process.

Furthermore, the review_mapping_controller plays a pivotal role in handling student requests for additional bonus assessments. These requests may arise due to various reasons such as a desire for more feedback, a pursuit of extra credit, or a need for reassessment. In responding to such requests, the controller must maintain alignment with the established guidelines and constraints of the assignments. This involves evaluating the feasibility of accommodating extra assessments without compromising the integrity or fairness of the evaluation process. Additionally, the controller may need to consider resource constraints, such as the availability of reviewers and the workload distribution among them.


Problem Statement

The review_mapping_controller presents a challenge due to its length, complexity, and sparse comments, making it difficult for developers to grasp its functionality efficiently. To address this, the controller should undergo a comprehensive refactoring process aimed at breaking down lengthy methods into smaller, more manageable pieces. This entails decomposing intricate logic into modular components, each responsible for a specific task or subtask within the overall functionality. Moreover, the refactoring effort should target instances of code duplication, consolidating repeated code segments into reusable functions or utility methods to enhance maintainability and reduce the risk of errors. By systematically restructuring the controller codebase and improving its documentation, developers can gain a clearer understanding of its inner workings, facilitating easier maintenance, debugging, and future enhancements.

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.

For Phase 1 of the project we have focused working on the below mentioned issues.
-Refactor assign_reviewer_dynamically function
-Corresponding changes to the tests for assign_reviewer_dynamically
-Refactor add_reviewer function
-Corresponding changes to the tests for add_reviewer
-Correct comments and add additional comments
-Methods are named descriptively to indicate their purpose
-Fixed Code climate issues

For Phase 2 of the project we plan working on the below mentioned issues.
-Refactor automatic_review_mapping function
-Refactor peer_review_strategy function
-Replace switch statements with subclasses methods
-Increase the test coverage
-Remove hardcoded parameters
-Create models for the subclasses

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.


Relevant Links

Team

Mentor

  • Ananya Mantravadi (amantra)

Team Members

  • Lagani Patel (lpatel)
  • Nidhay Pancholi (nrpancho)
  • Saloni Shah (sshah39)