CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy: Difference between revisions

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


*Some of the methods also needs to be renamed in this refactoring process for better understanding of the developers who will be working on the project later on.
*Some of the methods also needs to be renamed in this refactoring process for better understanding of the developers who will be working on the project later on.
The detailed problem statement is as follows:-
1. The function <b>show_review</b> inside <b>feedback_response_map.rb</b> file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews. For showing each reviews present in the response_map, the map object can be iterated in the controller class.
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed. The relationship is wrongly set as review has a response_map, which needs to be changed to response_map has many reviews.
3. The name of the method '''questionnaires''' is more localized in nature and it should be changed to '''“author_feedback_questionnaire”''' which will provide better understanding for the functionality of the method. Also it should be checked that if this method is required at all as author_feedback_questionnaire can be extracted from the Database directly very easily and whether this should be put into a separate method or not.
4. A method named <b>"latest_feedback"</b> which is present in the existing code should be removed from the feedback_response_map.rb class. Instead a method can be added to return a particular feedback according to the review_id which will reduce unnecessary data being provided to the user of this method.
5. The <b>scoring</b> class should be included with the <b>"response_map"</b> class so that it can add methods only to an instance of a class other than adding methods to the class.
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.
7. Throughout the project, polymorphism needs to be implemented in some of the places where if-else are being used to make the design adhere to Object Oriented Programming.


==Implementation==
==Implementation==

Revision as of 18:05, 6 April 2023

Introduction

Expertiza Background

When someone writes a review in Expertiza, they are creating an instance of the Response class. Each Response is created based on a particular ResponseMap. The ResponseMap tells who the reviewer is (the reviewer_id), who the reviewee is (the reviewee_id), and what is being reviewed (the reviewed_object_id).

  • The reviewer_id is normally a record in the Participants table, which specifies an AssignmentParticipant. However, if teams rather than individuals are doing reviews for this assignment, it may be an AssignmentTeam.
  • For reviews of student work, the reviewee_id is always an AssignmentTeam. (If an assignment is set up so individuals rather than teams submit work, the reviewee will still be a 1-member AssignmentTeam.)
  • For teammate reviews, the reviewee_id is always an AssignmentParticipant.
  • The reviewed_object_id is normally an Assignment. But in the case of meta-reviews, the reviewed_object_id is another ResponseMap (because it is a review that is being reviewed).

Problem Statement

We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[1]]). Some of the changes which are being pointed out till now are as follows-

  • In the previous re-implementation, some of the methods are defined in class level which can be modified to instance level methods for better functionality and adhering to the Object Oriented Design principles.
  • Few of the methods are also present in the existing project which should be implemented in other classes according to their functionality and for increasing coherency of the classes.
  • Some of the methods also needs to be renamed in this refactoring process for better understanding of the developers who will be working on the project later on.

The detailed problem statement is as follows:-

1. The function show_review inside feedback_response_map.rb file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews. For showing each reviews present in the response_map, the map object can be iterated in the controller class.

2. Accordingly, the relation between the Review class and the Response_map class needs to be changed. The relationship is wrongly set as review has a response_map, which needs to be changed to response_map has many reviews.

3. The name of the method questionnaires is more localized in nature and it should be changed to “author_feedback_questionnaire” which will provide better understanding for the functionality of the method. Also it should be checked that if this method is required at all as author_feedback_questionnaire can be extracted from the Database directly very easily and whether this should be put into a separate method or not.

4. A method named "latest_feedback" which is present in the existing code should be removed from the feedback_response_map.rb class. Instead a method can be added to return a particular feedback according to the review_id which will reduce unnecessary data being provided to the user of this method.

5. The scoring class should be included with the "response_map" class so that it can add methods only to an instance of a class other than adding methods to the class.

6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.

7. Throughout the project, polymorphism needs to be implemented in some of the places where if-else are being used to make the design adhere to Object Oriented Programming.

Implementation

Flowchart

Refactoring

Refactoring method

Function placed in the view as partials

Testing

RSpec Testing

Manual Testing

Design Pattern

References

Team Members