<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aitha</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aitha"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Aitha"/>
	<updated>2026-05-09T12:06:17Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150114</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150114"/>
		<updated>2023-04-25T01:41:59Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Screencast */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. The method &amp;lt;b&amp;gt;self.final_versions_from_reviewer&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. We removed the &amp;quot;latest_feedback&amp;quot; method from the feedback_response_map.rb. Modified the methods &amp;quot;self.feedback_response_report_by_round(&amp;quot; of the &amp;quot;feedback_response_map.rb&amp;quot; and &amp;quot;self.review_response_report&amp;quot; of the &amp;quot;review_response_map.rb&amp;quot;. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_4.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
3. A more flexible and extensible codebase is made possible by polymorphism, which enables objects of several classes to be viewed as belonging to the same class. This implies that, depending on their own implementation, objects of different classes may reply to the same message or method in various ways. For instance, a &amp;quot;Vehicle&amp;quot; superclass can have subclasses like &amp;quot;Car,&amp;quot; &amp;quot;Bus,&amp;quot; and &amp;quot;Truck,&amp;quot; each having its own implementation of the &amp;quot;drive()&amp;quot; method. Despite the fact that each of these subclasses may drive differently in this situation, polymorphism enables the identical 'drive()' function to be used on any of them. An application's maintainability and flexibility are improved by polymorphism, which also helps to reduce code duplication and create reusable code.&lt;br /&gt;
&lt;br /&gt;
Just as in the above example, there is a common method named &amp;quot;title&amp;quot; in all the subclasses of response_map.rb. We implemented polymorphism and defined the method in the base class.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_polymorphism_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
4. There are many methods that are not used and defined in the response_map.rb. We removed some of the methods that are not used by any other child classes.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_method_removal_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
5. When a class is extended, it creates a tightly coupled relationship between the parent and child class, which can make it difficult to modify the behavior of the child class independently. In contrast, when a class is included, it creates a looser coupling and allows the child class to access the methods and attributes of the parent class without being tied to its implementation. This approach provides greater flexibility and makes it easier to modify the behavior of the child class without affecting the parent class. Additionally, including a class allows for multiple inheritances, where a class can inherit from multiple parent classes, providing even more flexibility and code reuse.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Scoring&amp;quot; class is extended by the &amp;quot;response_map.rb&amp;quot;. Changes are made to &amp;quot;include&amp;quot; this class rather than extending it.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet added for the review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_review_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet added for the teammate_response_map.rb and the email functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_teammate_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_email_teammate_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet for the response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_response_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet from the feedback_response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_feedback_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
The Iterator design pattern is a behavioral pattern that offers a mechanism to access an aggregate object's elements progressively without disclosing the implementation's inner workings. The pattern specifies a distinct object called an iterator that contains the iteration logic and offers a consistent interface for navigating the aggregate's elements. The Iterator pattern encourages loose coupling between the two by separating the traversal logic from the aggregate object, making it simpler to alter the implementation of one without impacting the other. When we need to traverse a collection of items in a specified order but don't want to reveal the collection's internal workings to the client code, we can use this pattern.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
https://www.youtube.com/watch?v=nWO_WLE4ClA&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150100</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150100"/>
		<updated>2023-04-25T00:29:44Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Our Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. The method &amp;lt;b&amp;gt;self.final_versions_from_reviewer&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. We removed the &amp;quot;latest_feedback&amp;quot; method from the feedback_response_map.rb. Modified the methods &amp;quot;self.feedback_response_report_by_round(&amp;quot; of the &amp;quot;feedback_response_map.rb&amp;quot; and &amp;quot;self.review_response_report&amp;quot; of the &amp;quot;review_response_map.rb&amp;quot;. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_4.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
3. A more flexible and extensible codebase is made possible by polymorphism, which enables objects of several classes to be viewed as belonging to the same class. This implies that, depending on their own implementation, objects of different classes may reply to the same message or method in various ways. For instance, a &amp;quot;Vehicle&amp;quot; superclass can have subclasses like &amp;quot;Car,&amp;quot; &amp;quot;Bus,&amp;quot; and &amp;quot;Truck,&amp;quot; each having its own implementation of the &amp;quot;drive()&amp;quot; method. Despite the fact that each of these subclasses may drive differently in this situation, polymorphism enables the identical 'drive()' function to be used on any of them. An application's maintainability and flexibility are improved by polymorphism, which also helps to reduce code duplication and create reusable code.&lt;br /&gt;
&lt;br /&gt;
Just as in the above example, there is a common method named &amp;quot;title&amp;quot; in all the subclasses of response_map.rb. We implemented polymorphism and defined the method in the base class.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_polymorphism_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
4. There are many methods that are not used and defined in the response_map.rb. We removed some of the methods that are not used by any other child classes.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_method_removal_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
5. When a class is extended, it creates a tightly coupled relationship between the parent and child class, which can make it difficult to modify the behavior of the child class independently. In contrast, when a class is included, it creates a looser coupling and allows the child class to access the methods and attributes of the parent class without being tied to its implementation. This approach provides greater flexibility and makes it easier to modify the behavior of the child class without affecting the parent class. Additionally, including a class allows for multiple inheritances, where a class can inherit from multiple parent classes, providing even more flexibility and code reuse.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Scoring&amp;quot; class is extended by the &amp;quot;response_map.rb&amp;quot;. Changes are made to &amp;quot;include&amp;quot; this class rather than extending it.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet added for the review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_review_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet added for the teammate_response_map.rb and the email functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_teammate_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_email_teammate_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet for the response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_response_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet from the feedback_response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_feedback_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
The Iterator design pattern is a behavioral pattern that offers a mechanism to access an aggregate object's elements progressively without disclosing the implementation's inner workings. The pattern specifies a distinct object called an iterator that contains the iteration logic and offers a consistent interface for navigating the aggregate's elements. The Iterator pattern encourages loose coupling between the two by separating the traversal logic from the aggregate object, making it simpler to alter the implementation of one without impacting the other. When we need to traverse a collection of items in a specified order but don't want to reveal the collection's internal workings to the client code, we can use this pattern.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150099</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150099"/>
		<updated>2023-04-25T00:29:13Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. The method &amp;lt;b&amp;gt;self.final_versions_from_reviewer&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. We removed the &amp;quot;latest_feedback&amp;quot; method from the feedback_response_map.rb. Modified the methods &amp;quot;self.feedback_response_report_by_round(&amp;quot; of the &amp;quot;feedback_response_map.rb&amp;quot; and &amp;quot;self.review_response_report&amp;quot; of the &amp;quot;review_response_map.rb&amp;quot;. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_visitor_sample_4.png]]&lt;br /&gt;
&lt;br /&gt;
3. A more flexible and extensible codebase is made possible by polymorphism, which enables objects of several classes to be viewed as belonging to the same class. This implies that, depending on their own implementation, objects of different classes may reply to the same message or method in various ways. For instance, a &amp;quot;Vehicle&amp;quot; superclass can have subclasses like &amp;quot;Car,&amp;quot; &amp;quot;Bus,&amp;quot; and &amp;quot;Truck,&amp;quot; each having its own implementation of the &amp;quot;drive()&amp;quot; method. Despite the fact that each of these subclasses may drive differently in this situation, polymorphism enables the identical 'drive()' function to be used on any of them. An application's maintainability and flexibility are improved by polymorphism, which also helps to reduce code duplication and create reusable code.&lt;br /&gt;
&lt;br /&gt;
Just as in the above example, there is a common method named &amp;quot;title&amp;quot; in all the subclasses of response_map.rb. We implemented polymorphism and defined the method in the base class.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_polymorphism_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
4. There are many methods that are not used and defined in the response_map.rb. We removed some of the methods that are not used by any other child classes.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_method_removal_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
5. When a class is extended, it creates a tightly coupled relationship between the parent and child class, which can make it difficult to modify the behavior of the child class independently. In contrast, when a class is included, it creates a looser coupling and allows the child class to access the methods and attributes of the parent class without being tied to its implementation. This approach provides greater flexibility and makes it easier to modify the behavior of the child class without affecting the parent class. Additionally, including a class allows for multiple inheritances, where a class can inherit from multiple parent classes, providing even more flexibility and code reuse.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Scoring&amp;quot; class is extended by the &amp;quot;response_map.rb&amp;quot;. Changes are made to &amp;quot;include&amp;quot; this class rather than extending it.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet added for the review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_review_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet added for the teammate_response_map.rb and the email functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_teammate_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_email_teammate_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet for the response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_response_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is a small code snippet from the feedback_response_map.rb&lt;br /&gt;
&lt;br /&gt;
[[File:E2314_test_feedback_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
The Iterator design pattern is a behavioral pattern that offers a mechanism to access an aggregate object's elements progressively without disclosing the implementation's inner workings. The pattern specifies a distinct object called an iterator that contains the iteration logic and offers a consistent interface for navigating the aggregate's elements. The Iterator pattern encourages loose coupling between the two by separating the traversal logic from the aggregate object, making it simpler to alter the implementation of one without impacting the other. When we need to traverse a collection of items in a specified order but don't want to reveal the collection's internal workings to the client code, we can use this pattern.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_email_teammate_sample_1.png&amp;diff=150098</id>
		<title>File:E2314 test email teammate sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_email_teammate_sample_1.png&amp;diff=150098"/>
		<updated>2023-04-25T00:28:01Z</updated>

		<summary type="html">&lt;p&gt;Aitha: test for email functionality of teammate_response.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;test for email functionality of teammate_response.rb&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_response_sample_1.png&amp;diff=150097</id>
		<title>File:E2314 test response sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_response_sample_1.png&amp;diff=150097"/>
		<updated>2023-04-25T00:25:48Z</updated>

		<summary type="html">&lt;p&gt;Aitha: tests for response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;tests for response_map.rb&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_review_sample_1.png&amp;diff=150096</id>
		<title>File:E2314 test review sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_review_sample_1.png&amp;diff=150096"/>
		<updated>2023-04-25T00:24:29Z</updated>

		<summary type="html">&lt;p&gt;Aitha: tests for review_response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;tests for review_response_map.rb&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_teammate_sample_1.png&amp;diff=150095</id>
		<title>File:E2314 test teammate sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_teammate_sample_1.png&amp;diff=150095"/>
		<updated>2023-04-25T00:22:00Z</updated>

		<summary type="html">&lt;p&gt;Aitha: test for teammate_response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;test for teammate_response_map.rb&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_feedback_sample_1.png&amp;diff=150094</id>
		<title>File:E2314 test feedback sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_test_feedback_sample_1.png&amp;diff=150094"/>
		<updated>2023-04-25T00:19:59Z</updated>

		<summary type="html">&lt;p&gt;Aitha: test sample for feedback_response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;test sample for feedback_response_map.rb&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150017</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150017"/>
		<updated>2023-04-24T17:05:39Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. The method &amp;lt;b&amp;gt;self.final_versions_from_reviewer&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. We removed the &amp;quot;latest_feedback&amp;quot; method from the feedback_response_map.rb. Modified the methods &amp;quot;self.feedback_response_report_by_round(&amp;quot; of the &amp;quot;feedback_response_map.rb&amp;quot; and &amp;quot;self.review_response_report&amp;quot; of the &amp;quot;review_response_map.rb&amp;quot;. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
3. A more flexible and extensible codebase is made possible by polymorphism, which enables objects of several classes to be viewed as belonging to the same class. This implies that, depending on their own implementation, objects of different classes may reply to the same message or method in various ways. For instance, a &amp;quot;Vehicle&amp;quot; superclass can have subclasses like &amp;quot;Car,&amp;quot; &amp;quot;Bus,&amp;quot; and &amp;quot;Truck,&amp;quot; each having its own implementation of the &amp;quot;drive()&amp;quot; method. Despite the fact that each of these subclasses may drive differently in this situation, polymorphism enables the identical 'drive()' function to be used on any of them. An application's maintainability and flexibility are improved by polymorphism, which also helps to reduce code duplication and create reusable code.&lt;br /&gt;
&lt;br /&gt;
Just as in the above example, there is a common method named &amp;quot;title&amp;quot; in all the subclasses of response_map.rb. We implemented polymorphism and defined the method in the base class.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_polymorphism_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
4. There are many methods that are not used and defined in the response_map.rb. We removed some of the methods that are not used by any other child classes.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_method_removal_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
5. When a class is extended, it creates a tightly coupled relationship between the parent and child class, which can make it difficult to modify the behavior of the child class independently. In contrast, when a class is included, it creates a looser coupling and allows the child class to access the methods and attributes of the parent class without being tied to its implementation. This approach provides greater flexibility and makes it easier to modify the behavior of the child class without affecting the parent class. Additionally, including a class allows for multiple inheritances, where a class can inherit from multiple parent classes, providing even more flexibility and code reuse.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Scoring&amp;quot; class is extended by the &amp;quot;response_map.rb&amp;quot;. Changes are made to &amp;quot;include&amp;quot; this class rather than extending it.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
The Iterator design pattern is a behavioral pattern that offers a mechanism to access an aggregate object's elements progressively without disclosing the implementation's inner workings. The pattern specifies a distinct object called an iterator that contains the iteration logic and offers a consistent interface for navigating the aggregate's elements. The Iterator pattern encourages loose coupling between the two by separating the traversal logic from the aggregate object, making it simpler to alter the implementation of one without impacting the other. When we need to traverse a collection of items in a specified order but don't want to reveal the collection's internal workings to the client code, we can use this pattern.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150016</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150016"/>
		<updated>2023-04-24T17:02:13Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Design Patterns Used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. The method &amp;lt;b&amp;gt;self.final_versions_from_reviewer&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. We removed the &amp;quot;latest_feedback&amp;quot; method from the feedback_response_map.rb. Modified the methods &amp;quot;self.feedback_response_report_by_round(&amp;quot; of the &amp;quot;feedback_response_map.rb&amp;quot; and &amp;quot;self.review_response_report&amp;quot; of the &amp;quot;review_response_map.rb&amp;quot;. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
3. A more flexible and extensible codebase is made possible by polymorphism, which enables objects of several classes to be viewed as belonging to the same class. This implies that, depending on their own implementation, objects of different classes may reply to the same message or method in various ways. For instance, a &amp;quot;Vehicle&amp;quot; superclass can have subclasses like &amp;quot;Car,&amp;quot; &amp;quot;Bus,&amp;quot; and &amp;quot;Truck,&amp;quot; each having its own implementation of the &amp;quot;drive()&amp;quot; method. Despite the fact that each of these subclasses may drive differently in this situation, polymorphism enables the identical 'drive()' function to be used on any of them. An application's maintainability and flexibility are improved by polymorphism, which also helps to reduce code duplication and create reusable code.&lt;br /&gt;
&lt;br /&gt;
Just as in the above example, there is a common method named &amp;quot;title&amp;quot; in all the subclasses of response_map.rb. We implemented polymorphism and defined the method in the base class.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_polymorphism_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
4. There are many methods that are not used and defined in the response_map.rb. We removed some of the methods that are not used by any other child classes.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_method_removal_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
5. When a class is extended, it creates a tightly coupled relationship between the parent and child class, which can make it difficult to modify the behavior of the child class independently. In contrast, when a class is included, it creates a looser coupling and allows the child class to access the methods and attributes of the parent class without being tied to its implementation. This approach provides greater flexibility and makes it easier to modify the behavior of the child class without affecting the parent class. Additionally, including a class allows for multiple inheritances, where a class can inherit from multiple parent classes, providing even more flexibility and code reuse.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Scoring&amp;quot; class is extended by the &amp;quot;response_map.rb&amp;quot;. Changes are made to &amp;quot;include&amp;quot; this class rather than extending it.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
The Iterator design pattern is a behavioral pattern that offers a mechanism to access an aggregate object's elements progressively without disclosing the implementation's inner workings. The pattern specifies a distinct object called an iterator that contains the iteration logic and offers a consistent interface for navigating the aggregate's elements. The Iterator pattern encourages loose coupling between the two by separating the traversal logic from the aggregate object, making it simpler to alter the implementation of one without impacting the other. When we need to traverse a collection of items in a specified order but don't want to reveal the collection's internal workings to the client code, we can use this pattern.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150015</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150015"/>
		<updated>2023-04-24T16:57:26Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. The method &amp;lt;b&amp;gt;self.final_versions_from_reviewer&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. We removed the &amp;quot;latest_feedback&amp;quot; method from the feedback_response_map.rb. Modified the methods &amp;quot;self.feedback_response_report_by_round(&amp;quot; of the &amp;quot;feedback_response_map.rb&amp;quot; and &amp;quot;self.review_response_report&amp;quot; of the &amp;quot;review_response_map.rb&amp;quot;. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
3. A more flexible and extensible codebase is made possible by polymorphism, which enables objects of several classes to be viewed as belonging to the same class. This implies that, depending on their own implementation, objects of different classes may reply to the same message or method in various ways. For instance, a &amp;quot;Vehicle&amp;quot; superclass can have subclasses like &amp;quot;Car,&amp;quot; &amp;quot;Bus,&amp;quot; and &amp;quot;Truck,&amp;quot; each having its own implementation of the &amp;quot;drive()&amp;quot; method. Despite the fact that each of these subclasses may drive differently in this situation, polymorphism enables the identical 'drive()' function to be used on any of them. An application's maintainability and flexibility are improved by polymorphism, which also helps to reduce code duplication and create reusable code.&lt;br /&gt;
&lt;br /&gt;
Just as in the above example, there is a common method named &amp;quot;title&amp;quot; in all the subclasses of response_map.rb. We implemented polymorphism and defined the method in the base class.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_polymorphism_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
4. There are many methods that are not used and defined in the response_map.rb. We removed some of the methods that are not used by any other child classes.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_method_removal_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
5. When a class is extended, it creates a tightly coupled relationship between the parent and child class, which can make it difficult to modify the behavior of the child class independently. In contrast, when a class is included, it creates a looser coupling and allows the child class to access the methods and attributes of the parent class without being tied to its implementation. This approach provides greater flexibility and makes it easier to modify the behavior of the child class without affecting the parent class. Additionally, including a class allows for multiple inheritances, where a class can inherit from multiple parent classes, providing even more flexibility and code reuse.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Scoring&amp;quot; class is extended by the &amp;quot;response_map.rb&amp;quot;. Changes are made to &amp;quot;include&amp;quot; this class rather than extending it.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150014</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150014"/>
		<updated>2023-04-24T16:56:20Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Our Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. We removed the &amp;quot;latest_feedback&amp;quot; method from the feedback_response_map.rb. Modified the methods &amp;quot;self.feedback_response_report_by_round(&amp;quot; of the &amp;quot;feedback_response_map.rb&amp;quot; and &amp;quot;self.review_response_report&amp;quot; of the &amp;quot;review_response_map.rb&amp;quot;. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
3. A more flexible and extensible codebase is made possible by polymorphism, which enables objects of several classes to be viewed as belonging to the same class. This implies that, depending on their own implementation, objects of different classes may reply to the same message or method in various ways. For instance, a &amp;quot;Vehicle&amp;quot; superclass can have subclasses like &amp;quot;Car,&amp;quot; &amp;quot;Bus,&amp;quot; and &amp;quot;Truck,&amp;quot; each having its own implementation of the &amp;quot;drive()&amp;quot; method. Despite the fact that each of these subclasses may drive differently in this situation, polymorphism enables the identical 'drive()' function to be used on any of them. An application's maintainability and flexibility are improved by polymorphism, which also helps to reduce code duplication and create reusable code.&lt;br /&gt;
&lt;br /&gt;
Just as in the above example, there is a common method named &amp;quot;title&amp;quot; in all the subclasses of response_map.rb. We implemented polymorphism and defined the method in the base class.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_polymorphism_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
4. There are many methods that are not used and defined in the response_map.rb. We removed some of the methods that are not used by any other child classes.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_method_removal_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
5. When a class is extended, it creates a tightly coupled relationship between the parent and child class, which can make it difficult to modify the behavior of the child class independently. In contrast, when a class is included, it creates a looser coupling and allows the child class to access the methods and attributes of the parent class without being tied to its implementation. This approach provides greater flexibility and makes it easier to modify the behavior of the child class without affecting the parent class. Additionally, including a class allows for multiple inheritances, where a class can inherit from multiple parent classes, providing even more flexibility and code reuse.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Scoring&amp;quot; class is extended by the &amp;quot;response_map.rb&amp;quot;. Changes are made to &amp;quot;include&amp;quot; this class rather than extending it.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150013</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150013"/>
		<updated>2023-04-24T16:32:53Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Our Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
3. A more flexible and extensible codebase is made possible by polymorphism, which enables objects of several classes to be viewed as belonging to the same class. This implies that, depending on their own implementation, objects of different classes may reply to the same message or method in various ways. For instance, a &amp;quot;Vehicle&amp;quot; superclass can have subclasses like &amp;quot;Car,&amp;quot; &amp;quot;Bus,&amp;quot; and &amp;quot;Truck,&amp;quot; each having its own implementation of the &amp;quot;drive()&amp;quot; method. Despite the fact that each of these subclasses may drive differently in this situation, polymorphism enables the identical 'drive()' function to be used on any of them. An application's maintainability and flexibility are improved by polymorphism, which also helps to reduce code duplication and create reusable code.&lt;br /&gt;
&lt;br /&gt;
Just as in the above example, there is a common method named &amp;quot;title&amp;quot; in all the subclasses of response_map.rb. We implemented polymorphism and defined the method in the base class.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_polymorphism_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
4. There is a lot of code and methods that are not used and defined in the response_map.rb. We removed some of the methods that are not used by any other child classes.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_method_removal_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_method_removal_sample_1.png&amp;diff=150012</id>
		<title>File:E2338 method removal sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_method_removal_sample_1.png&amp;diff=150012"/>
		<updated>2023-04-24T16:32:18Z</updated>

		<summary type="html">&lt;p&gt;Aitha: Remove unwanted methods&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Remove unwanted methods&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_polymorphism_sample_1.png&amp;diff=150011</id>
		<title>File:E2338 polymorphism sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_polymorphism_sample_1.png&amp;diff=150011"/>
		<updated>2023-04-24T16:29:31Z</updated>

		<summary type="html">&lt;p&gt;Aitha: polymorphism for 'title' method&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;polymorphism for 'title' method&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150010</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150010"/>
		<updated>2023-04-24T16:23:52Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Our Solution===&lt;br /&gt;
1. The Iterator Pattern is a behavioral design pattern that offers a method for sequentially accessing the components of an aggregate object without disclosing how it was really implemented. It offers a uniform interface for object collection traversal so that client code can traverse through collections of objects uniformly regardless of the collection type. The Iterator, which specifies the interface for navigating the collection, and the Aggregate, which defines the interface for constructing an Iterator object, make up the two primary parts of the pattern. The Iterator Pattern enables client programs to iterate over collections without worrying about the specifics of how they are implemented since it separates collection traversal from implementation. &lt;br /&gt;
&lt;br /&gt;
The Original code was returning data structures in multiple methods. We used &amp;lt;b&amp;gt;Iterator Design Pattern&amp;lt;/b&amp;gt; to avoid returning structures that need an understanding at the receiver. The following are some of the code snippets.&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_1.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_2.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2338_iterator_sample_3.png | 1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_iterator_sample_3.png&amp;diff=150009</id>
		<title>File:E2338 iterator sample 3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_iterator_sample_3.png&amp;diff=150009"/>
		<updated>2023-04-24T16:23:00Z</updated>

		<summary type="html">&lt;p&gt;Aitha: Iterator class for feedback_response_map&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Iterator class for feedback_response_map&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_iterator_sample_2.png&amp;diff=150008</id>
		<title>File:E2338 iterator sample 2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_iterator_sample_2.png&amp;diff=150008"/>
		<updated>2023-04-24T16:21:40Z</updated>

		<summary type="html">&lt;p&gt;Aitha: Iterator pattern for feedback_response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Iterator pattern for feedback_response_map.rb&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_iterator_sample_1.png&amp;diff=150007</id>
		<title>File:E2338 iterator sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_iterator_sample_1.png&amp;diff=150007"/>
		<updated>2023-04-24T16:20:31Z</updated>

		<summary type="html">&lt;p&gt;Aitha: Iterator Pattern code change for review_response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Iterator Pattern code change for review_response_map.rb&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150006</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150006"/>
		<updated>2023-04-24T15:59:19Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* How to Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a &amp;lt;b&amp;gt;CSC-517 Expertiza Development Environment&amp;lt;/b&amp;gt; VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. &amp;lt;b&amp;gt;sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. &amp;lt;b&amp;gt;sudo chmod +x setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Run the script. &amp;lt;b&amp;gt;./setup_expertiza.sh&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;rake db:create&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. &amp;lt;b&amp;gt;rake db:migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. &amp;lt;b&amp;gt;rake test TESTOPTS=&amp;quot;-v&amp;quot;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150005</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150005"/>
		<updated>2023-04-24T15:57:07Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Patterns Used==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150004</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150004"/>
		<updated>2023-04-24T15:56:51Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150003</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=150003"/>
		<updated>2023-04-24T15:55:58Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Team Members */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*A few of the methods which are also present in the existing project should be moved to other classes according to their functionality in order to increase cohesion of the classes.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For implementation of the visitor pattern for send_email function, We have created a &amp;lt;b&amp;gt;&amp;quot;email_sending_visitor&amp;quot;&amp;lt;/b&amp;gt; class which implements the visit method and &amp;lt;b&amp;gt;&amp;quot;email_sending_method&amp;quot;&amp;lt;/b&amp;gt; which accepts a visitor. Then we extended these classes to create sub-classes according to the project requirement, for example defining &amp;lt;b&amp;gt;&amp;quot;author_feedback_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; for defining send_email method used in &amp;lt;b&amp;gt;&amp;quot;feedback_response_map&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;quot;teammate_review_email_sending_method&amp;quot;&amp;lt;/b&amp;gt; to implement the send_email method for &amp;lt;b&amp;gt;&amp;quot;teammate_review_response_map&amp;quot;&amp;lt;/b&amp;gt;. Then we call the send_email method from the appropriate classes which acts as a visitor to the original send_email method.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;br /&gt;
&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149490</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149490"/>
		<updated>2023-04-12T20:33:58Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha&lt;br /&gt;
&lt;br /&gt;
Aswin Itha &lt;br /&gt;
&lt;br /&gt;
Srini Iyer&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149489</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149489"/>
		<updated>2023-04-12T20:33:24Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; file needs to be removed as reviews belongs to a response_map and hence one response_map can have lot of reviews.&lt;br /&gt;
&lt;br /&gt;
2. Accordingly, the relation between the Review class and the Response_map class needs to be changed.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems&lt;br /&gt;
1. For showing each review present in the response_map, the map object is to be iterated in the controller class using the &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. The relationship is wrongly set as the review has a response_map, which needs to be changed to response_map has many reviews.&lt;br /&gt;
&lt;br /&gt;
3. Rename the &amp;quot;questionnaire&amp;quot; method to &amp;quot;author_feedback_questionnaire&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
4. Modify the &amp;quot;latest_feedback&amp;quot; method to return the data of a particular response_map and not a data structure. The input variable is to be set to receive the review id.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;quot;questionnaire&amp;quot; will be defined in the &amp;quot;response.rb&amp;quot; class. Polymorphism is to be used in the child classes to define its variation.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha&lt;br /&gt;
&lt;br /&gt;
Aswin Itha &lt;br /&gt;
&lt;br /&gt;
Srini Iyer&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149486</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149486"/>
		<updated>2023-04-12T20:23:27Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha&lt;br /&gt;
&lt;br /&gt;
Aswin Itha &lt;br /&gt;
&lt;br /&gt;
Srini Iyer&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149448</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149448"/>
		<updated>2023-04-12T18:12:59Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
&lt;br /&gt;
1. &amp;quot;show_review&amp;quot; will be removed from the &amp;quot;feedbask_response_map.rb&amp;quot; and will be added to the &amp;quot;response.rb&amp;quot; using &amp;quot;Iterator Pattern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names, '''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
For the &amp;quot;email&amp;quot; implementation, we plan to use '''Visitor Pattern'''. This will allow us to add new operations to the class without actually modifying it.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha&lt;br /&gt;
&lt;br /&gt;
Aswin Itha &lt;br /&gt;
&lt;br /&gt;
Srini Iyer&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149447</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=149447"/>
		<updated>2023-04-12T18:02:51Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Overall Impact of our Design===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Classes impacted and their relationship===&lt;br /&gt;
&lt;br /&gt;
[[File:E2338 design sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;How&amp;quot; we plan to solve the problems===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map. &lt;br /&gt;
&lt;br /&gt;
We have implemented few of the tests previously but these tests needs to be modified according to the refactoring done on the project.&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tests to be added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a description or template for how to solve a problem that can be used in many different situations.&lt;br /&gt;
&lt;br /&gt;
During the process of refactoring methods as well as method names,'''Strategy Pattern''' was used in the implementation. The Strategy pattern is most useful when you want to provide multiple ways of processing a request, without hard-coding knowledge about those different methods into the object that handles the request. We may implement some more design patterns which we think might be necessary while refactoring the project.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [https://www.rubyguides.com/2015/12/ruby-refactoring/ Introduction to Refractoring in Ruby]&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/sbiyer/reimplementation-back-end Github project]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
Suparno Saha&lt;br /&gt;
&lt;br /&gt;
Aswin Itha &lt;br /&gt;
&lt;br /&gt;
Srini Iyer&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_design_sample_2.png&amp;diff=149446</id>
		<title>File:E2338 design sample 2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2338_design_sample_2.png&amp;diff=149446"/>
		<updated>2023-04-12T18:00:23Z</updated>

		<summary type="html">&lt;p&gt;Aitha: The classes impacted by the new design and their relationship.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The classes impacted by the new design and their relationship.&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023&amp;diff=149430</id>
		<title>CSC/ECE 517 Spring 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023&amp;diff=149430"/>
		<updated>2023-04-12T12:27:56Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 -E2306. Refactor user_controller.rb, user.rb and its child classes]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2320. Reimplement the Question hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2312 + E2313. Reimplement response.rb and responses_controller.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - NTNX-1. Support provisioning MongoDb via NDB Kubernetes Operator]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2316. Reimplement sign_up_sheet_controller.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2315. Reimplement signed_up_team.rb, sign_up_topic.rb, sign_up_sheet.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2339. Reimplement signed_up_team.rb, sign_up_topic.rb, sign_up_sheet.rb (Project 4)]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2323. Refactor DueDate functionality from assignment.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2317: Reimplement participant.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023- NTNX-4. Extend NDB operator provision postregresql aws]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2321. Reimplement QuestionnairesController and QuestionsController]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2305. Grading audit trail]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2329. Grading audit trail(Project 4)]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2309. Refactor Node model and its subclasses]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - NTNX-2. Support provisioning mySQL databases via NDB Kubernetes Operator]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2300. Refactor E1858. Github metrics integration]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Sping 2023 - E2322: Refactor Questionnaire View to display Bookmark Rating]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - NTNX-3. Refactor models to keep profiles (software, compute, network, etc) as optional and use default if not specified]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2301._Refactor_review_maping_helper]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2330._Reimplementation_Invitation_Controller]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2337._Reimplement_node_hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-E2339._Reimplement signed_up_teams_controller and sign_up_topics_controller.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2320._Reimplement the Question Hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023 - E2341. UI for Participants.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2336._Reimplement_response.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2345._Reimplement_QuestionnairesController_and_QuestionsController]]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148967</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148967"/>
		<updated>2023-04-07T13:47:47Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are refactoring the code which are being implemented previously for Re-implementation of response map hierarchy (E2314[[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy]]). Some of the changes which are being pointed out till now are as follows-&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
The detailed problem statement is as follows:-&lt;br /&gt;
&lt;br /&gt;
1. The function &amp;lt;b&amp;gt;show_review&amp;lt;/b&amp;gt; inside &amp;lt;b&amp;gt;feedback_response_map.rb&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
4. A method named &amp;lt;b&amp;gt;&amp;quot;latest_feedback&amp;quot;&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
5. The &amp;lt;b&amp;gt;scoring&amp;lt;/b&amp;gt; class should be included with the &amp;lt;b&amp;gt;&amp;quot;response_map&amp;quot;&amp;lt;/b&amp;gt; class so that it can add methods only to an instance of a class other than adding methods to the class.&lt;br /&gt;
&lt;br /&gt;
6. Remove few of the methods from response_map.rb which are not relevant and should instead be used in the controller class.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
8. There is a &amp;lt;b&amp;gt;questionnaire&amp;lt;/b&amp;gt; method implemented in each sub class where the &amp;quot;reviewer&amp;quot; or &amp;quot;reviewee&amp;quot; is assigned. This functionality can be implemented in the super class and assign the value based on the class name.&lt;br /&gt;
&lt;br /&gt;
9. &amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt; method is implemented to uniquely identify the response_maps belonging to that sub class. Reimplement this in the super class.&lt;br /&gt;
&lt;br /&gt;
10. The &amp;lt;b&amp;gt;email&amp;lt;/b&amp;gt; method is written in each subclass to suit the response locally. &amp;lt;b&amp;gt;Visitor Pattern&amp;lt;/b&amp;gt; can be used here to attach the functionality rather than making it a part of each subclass.&lt;br /&gt;
&lt;br /&gt;
11. The &amp;lt;b&amp;gt;after_initialize&amp;lt;/b&amp;gt; function present in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; allows a team to review rather than individuals if needed. Verify if any database normalization principles are violated and take a decision on reimplementing it.&lt;br /&gt;
&lt;br /&gt;
12. The method &amp;lt;b&amp;gt;responses_for_team_round&amp;lt;/b&amp;gt; in &amp;lt;b&amp;gt;review_response_map.rb&amp;lt;/b&amp;gt; is returning a data structure that contains responses from all the rounds. Reimplement it so that the calling function queries for a specific round and only one response is returned rather than the complete data structure.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Flowchart===&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
====Refactoring method====&lt;br /&gt;
===Function placed in the view as partials===&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148826</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148826"/>
		<updated>2023-04-06T00:34:09Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Expertiza Background===&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Flowchart===&lt;br /&gt;
===Refactoring===&lt;br /&gt;
====Refactoring method====&lt;br /&gt;
===Function placed in the view as partials===&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
===Manual Testing===&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148825</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148825"/>
		<updated>2023-04-06T00:32:39Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;##Introduction&lt;br /&gt;
&lt;br /&gt;
###Expertiza Background&lt;br /&gt;
###Problem Statement&lt;br /&gt;
&lt;br /&gt;
##Implementation&lt;br /&gt;
### Flowchart&lt;br /&gt;
###Refactoring&lt;br /&gt;
####Refactoring method&lt;br /&gt;
###Function placed in the view as partials&lt;br /&gt;
&lt;br /&gt;
##Testing&lt;br /&gt;
###RSpec Testing&lt;br /&gt;
###Manual Testing&lt;br /&gt;
&lt;br /&gt;
##Design Pattern&lt;br /&gt;
&lt;br /&gt;
##References&lt;br /&gt;
&lt;br /&gt;
##Team Members&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148824</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148824"/>
		<updated>2023-04-06T00:32:05Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;##Introduction##&lt;br /&gt;
&lt;br /&gt;
###Expertiza Background&lt;br /&gt;
###Problem Statement###&lt;br /&gt;
&lt;br /&gt;
##Implementation##&lt;br /&gt;
### Flowchart###&lt;br /&gt;
###Refactoring###&lt;br /&gt;
####Refactoring method####&lt;br /&gt;
###Function placed in the view as partials###&lt;br /&gt;
&lt;br /&gt;
##Testing##&lt;br /&gt;
###RSpec Testing###&lt;br /&gt;
###Manual Testing###&lt;br /&gt;
&lt;br /&gt;
##Design Pattern##&lt;br /&gt;
&lt;br /&gt;
##References##&lt;br /&gt;
&lt;br /&gt;
##Team Members##&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148820</id>
		<title>CSC/ECE 517 Spring 2023 - E2338. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2338._Reimplement_the_response_map_hierarchy&amp;diff=148820"/>
		<updated>2023-04-06T00:20:17Z</updated>

		<summary type="html">&lt;p&gt;Aitha: Created page with &amp;quot;Index&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Index&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148518</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148518"/>
		<updated>2023-03-28T00:46:24Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====Note====&lt;br /&gt;
The scope of the project is limited to the model review_response_map. So, no controllers are used in the implementation. Due to this reason, it is not possible to perform functional testing or test the response using multiple controllers. We have stubbed dummy data necessary for testing the model and imitating the response from controllers. The in-built rails framework is used for Testing.&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
The project required to use export functionality based on [https://expertiza.csc.ncsu.edu/index.php/CSC517_Spring_2019/E1923_New_Framework_For_Import/Export this] framework. However, both the import and export frameworks are not available on the main branch of the project. This can be done as future work once the main branch of Expertiza is updated with the framework.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148511</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148511"/>
		<updated>2023-03-28T00:11:46Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====Note====&lt;br /&gt;
The scope of the project is limited to the model review_response_map. So, no controllers are used in the implementation. Due to this reason, it is not possible to perform functional testing or test the response using multiple controllers. We have stubbed dummy data necessary for testing the model and imitating the response from controllers. The in-built rails framework is used for Testing.&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the review functionality&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if feedback can be given to a review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test if the response_map was metareviewed by metareviewer&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test if the metareviewer to this review(response) is assigned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test if the right teammates are associated with a review&lt;br /&gt;
|}&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148498</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148498"/>
		<updated>2023-03-28T00:04:21Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====Note====&lt;br /&gt;
The scope of the project is limited to the model review_response_map. So, no controllers are used in the implementation. Due to this reason, it is not possible to perform functional testing or test the response using multiple controllers. We have stubbed dummy data necessary for testing the model and imitating the response from controllers. The in-built rails framework is used for Testing.&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the right questionnaire is accessed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests if the right fields are exported&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the metareview_response_maps function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests if the reviewer obtained is the right one&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the reviewer can be retrieved with id&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests if the last review for a team is available&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Tests if the team email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
| 8 || Tests if the prepare_final_review_versions function is returning right review id&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ teammate_review_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the working of questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test if the team's questionnaire is accessable&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test the questionnaire with nil values&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test the questionnaire with non nil values&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Test the reviewer details of a team review&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Test the teammate_response_report functionality and see if right map is returned&lt;br /&gt;
|-&lt;br /&gt;
| 7 || Check the email functionality for a team assignment review&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Tests the email functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148478</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148478"/>
		<updated>2023-03-27T23:50:13Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* New Test Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====Note====&lt;br /&gt;
The scope of the project is limited to the model review_response_map. So, no controllers are used in the implementation. Due to this reason, it is not possible to perform functional testing or test the response using multiple controllers. We have stubbed dummy data necessary for testing the model and imitating the response from controllers. The in-built rails framework is used for Testing.&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
feedback_response_map.rb testing&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:40px&amp;quot;&lt;br /&gt;
|+ feedback_response_map_test.rb&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
| -&lt;br /&gt;
| 6 || Tests if the email functionality is working&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148474</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148474"/>
		<updated>2023-03-27T23:48:46Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====Note====&lt;br /&gt;
The scope of the project is limited to the model review_response_map. So, no controllers are used in the implementation. Due to this reason, it is not possible to perform functional testing or test the response using multiple controllers. We have stubbed dummy data necessary for testing the model and imitating the response from controllers. The in-built rails framework is used for Testing.&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
feedback_response_map.rb testing&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:40px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Test No. !! Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Tests if the assignment object is available&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Tests the show_review&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Tests if the title function is working&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Tests the questionnaire function and if the right question ids are returned&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Tests if the right contributor is returned&lt;br /&gt;
| -&lt;br /&gt;
| 6 || Tests if the email functionality is working&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148456</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148456"/>
		<updated>2023-03-27T23:30:52Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* =Note */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====Note====&lt;br /&gt;
The scope of the project is limited to the model review_response_map. So, no controllers are used in the implementation. Due to this reason, it is not possible to perform functional testing or test the response using multiple controllers. The in-built rails framework is used for Testing.&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148455</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148455"/>
		<updated>2023-03-27T23:29:13Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
====Note===&lt;br /&gt;
The scope of the project is limited to the model review_response_map. So, no controllers are used in the implementation. Due to this reason, it is not possible to perform functional testing or test the response using multiple controllers.&lt;br /&gt;
&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148397</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=148397"/>
		<updated>2023-03-27T19:32:19Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Methods Moved to Response Class */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147752</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147752"/>
		<updated>2023-03-22T02:35:45Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
[https://expertiza.ncsu.edu/submitted_content/download?current_folder%5Bname%5D=%2Fvar%2Fwww%2Fexpertiza%2Freleases%2F20210417040133%2Fpg_data%2Fefg%2Fcsc517%2Fs23%2Foss%2F0&amp;amp;download=CSC_517_OSS_Project_Tests.mp4&amp;amp;id=49700 Screencast]&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
The pull request raised to be merged with https://github.com/expertiza/reimplementation-back-end original implementation is found at https://github.com/expertiza/reimplementation-back-end/pull/21&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147750</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147750"/>
		<updated>2023-03-22T02:30:47Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:E2314 design sample 1.png]]&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_design_sample_1.png&amp;diff=147748</id>
		<title>File:E2314 design sample 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2314_design_sample_1.png&amp;diff=147748"/>
		<updated>2023-03-22T02:30:33Z</updated>

		<summary type="html">&lt;p&gt;Aitha: Design diagram proposed with the new enhancements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design diagram proposed with the new enhancements&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147747</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147747"/>
		<updated>2023-03-22T02:29:22Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* How to Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|1000px]]&lt;br /&gt;
[[File:E2314 tests 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147746</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147746"/>
		<updated>2023-03-22T02:29:08Z</updated>

		<summary type="html">&lt;p&gt;Aitha: /* How to Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
Here are step-by-step instructions for setting up Expertiza backend repository on a CSC-517 Expertiza Development Environment VCL session.&lt;br /&gt;
&lt;br /&gt;
1. Copy the &amp;quot;/root/setup_expertiza.sh&amp;quot; script to your home directory. sudo cp /root/setup_expertiza.sh ~/setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
2. Make the script executable. sudo chmod +x setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
3. Run the script. ./setup_expertiza.sh&lt;br /&gt;
&lt;br /&gt;
4. Provide the GitHub repository URL. Once the script runs, you will be prompted to enter the GitHub repository URL for the project you want to work on.&lt;br /&gt;
&lt;br /&gt;
5. Select the project type (Refactoring or Reimplementation)&lt;br /&gt;
&lt;br /&gt;
6. Wait for the setup to complete and terminate the terminals.&lt;br /&gt;
 &lt;br /&gt;
7. Change the username in config/database.yml from root to dev on line 4 --- username: dev&lt;br /&gt;
&lt;br /&gt;
8. cd into the root of the project&lt;br /&gt;
&lt;br /&gt;
9. rake db:create&lt;br /&gt;
&lt;br /&gt;
10. rake db:migrate&lt;br /&gt;
&lt;br /&gt;
11. rake test TESTOPTS=&amp;quot;-v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests 1.png|100px]]&lt;br /&gt;
[[File:E2314 tests 2.png|100px]]&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023&amp;diff=147694</id>
		<title>CSC/ECE 517 Spring 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023&amp;diff=147694"/>
		<updated>2023-03-22T01:09:47Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2320. Reimplement the Question hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2312 + E2313. Reimplement response.rb and responses_controller.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - CSC517. Support provisioning MongoDb via NDB Kubernetes Operator]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2316. Reimplement sign_up_sheet_controller.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2315. Reimplement signed_up_team.rb, sign_up_topic.rb, sign_up_sheet.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2323. Refactor DueDate functionality from assignment.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy]]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147686</id>
		<title>CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2314._Reimplement_the_response_map_hierarchy&amp;diff=147686"/>
		<updated>2023-03-22T00:44:42Z</updated>

		<summary type="html">&lt;p&gt;Aitha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
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).&lt;br /&gt;
* 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.&lt;br /&gt;
* 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.)&lt;br /&gt;
* For teammate reviews, the reviewee_id is always an AssignmentParticipant.&lt;br /&gt;
* 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).&lt;br /&gt;
&lt;br /&gt;
==Project Requirements==&lt;br /&gt;
This project aims to re-implement the ResponseMap hierarchy in Expertiza to simplify its design and reduce the number of class methods. Specifically, this project will focus on re-implementing three of the ResponseMap subclasses: ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps.&lt;br /&gt;
&lt;br /&gt;
The ResponseMap hierarchy is a critical component of Expertiza, as it defines the relationship between reviewers, reviewees, and the objects being reviewed. In the current implementation, there are several issues that need to be addressed to improve the overall design and functionality of the hierarchy. For example, the current hierarchy is cluttered with class methods, which makes it difficult to maintain and update. Additionally, some methods belong in the Response class while others belong in the ResponseMap subclasses.&lt;br /&gt;
&lt;br /&gt;
To address these issues, this project will begin by creating a simplified version of the Response class that includes only the methods that belong in that class. This will make it easier to merge the new Response class with the ResponseMap subclasses that are being re-implemented.&lt;br /&gt;
&lt;br /&gt;
Next, the ReviewResponseMap export operation will be re-implemented based on the new Response class framework. This will make the export operation simpler and easier to use. Additionally, the comparator method will be replaced by an overloading of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
Several methods that return Responses in the ResponseMap subclasses will be moved to the Response class. This will improve the overall organization of the hierarchy and make it easier to maintain and update in the future. Methods whose name begins with &amp;quot;get&amp;quot; will be renamed to follow Ruby conventions, as this will make the code easier to read and understand.&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap is used for giving author feedback, which will be considered when re-implementing this subclass. Specifically, the methods in this subclass will be reviewed to ensure that they are properly named and that they follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
Overall, the main requirements for this project include:&lt;br /&gt;
* Re-implementing three of the ResponseMap subclasses (ReviewResponseMaps, FeedbackResponseMaps, and TeammateReviewResponseMaps)&lt;br /&gt;
* Simplifying the ResponseMap hierarchy to reduce the number of class methods&lt;br /&gt;
* Creating a simplified version of the Response class that includes only the methods that belong in that class&lt;br /&gt;
* Re-implementing the ReviewResponseMap export operation based on the new Response class framework&lt;br /&gt;
* Replacing the comparator method with overloading of the &amp;lt;=&amp;gt; operator&lt;br /&gt;
* Moving several methods that return Responses in the ResponseMap subclasses to the Response class&lt;br /&gt;
* Renaming methods whose name begins with &amp;quot;get&amp;quot; to follow Ruby conventions&lt;br /&gt;
* Reviewing the FeedbackResponseMap subclass to ensure its methods are appropriately named and follow Ruby conventions.&lt;br /&gt;
&lt;br /&gt;
By completing these requirements, the ResponseMap hierarchy in Expertiza will be improved and easier to maintain and update in the future.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
==Our Enhancements==&lt;br /&gt;
===Comment Lines===&lt;br /&gt;
Each well-written code must contain comment lines that explain the purpose of each method's class. It is simpler for other developers to comprehend and use the code because these comment lines offer a concise and clear explanation of what the method performs. Also, comment lines contribute to the code's maintainability and scalability by supplying context and facilitating simpler debugging and modification. It can be difficult for other developers to comprehend a method's purpose without comment lines, especially if the code is complex or if they need to become more familiar with the programming language. Therefore, to ensure that the code is well-documented, maintainable, and scalable, it is crucial to include comment lines describing the purpose of a method in a class.&lt;br /&gt;
&lt;br /&gt;
Each method has no comment lines in Expertiza's current implementation. All available methods in the response maps class have comment lines added as project guidelines require. The sample work with comment lines is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 comment line sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Variable and Method names===&lt;br /&gt;
Using appropriate variable and method names while writing code is imperative for various reasons. The first benefit of giving code meaningful names is that they make it easier for future developers to read and comprehend the code. Clear and informative variable and method names simplify comprehending what a specific piece of code does, ultimately saving time and effort. Second, exact terms contribute to better code quality and error prevention. The likelihood that variables and methods may be misused, leading to problems or faults in the code, is reduced when their names appropriately reflect what they do. Finally, code is more scalable and maintainable when it has meaningful names. Well-chosen variable and method names simplify adapting and growing the code over time without creating errors or ambiguity. As a result of increased readability, reduced error rates, and increased maintainability and scalability, utilizing meaningful variable and method names is a critical best practice when writing code.&lt;br /&gt;
&lt;br /&gt;
We have renamed many variable and method names as part of the project. To adhere to the Ruby standards, we have removed the word &amp;quot;get&amp;quot; when starting a method name. Our sample work is below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 naming sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Name of method changed from &amp;quot;email&amp;quot; to &amp;quot;send_email&amp;quot;&lt;br /&gt;
[[File:E2314 naming sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;=&amp;gt; Operators===&lt;br /&gt;
The rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; is a built-in comparison operator in Ruby that offers a clear and effective way to sort and compare things. The rocket operator can sort items according to their attributes rather than creating our comparator function. The rocket operator yields 0 if the two objects under comparison are equal, -1 if the left object is smaller than the right object, and 1 if the left object is larger than the right object. The rocket operator offers a consistent and dependable technique to compare and classify objects while also saving time and effort. Creating our own comparator function may be more error-prone and less effective than the built-in operator. Also, employing the rocket operator can aid in reducing code complexity and enhancing readability because other writers are more likely to be familiar with the operator than with a unique comparator function. As a result, it is advised to use the rocket operator &amp;quot;&amp;lt;=&amp;gt;&amp;quot; wherever possible rather than creating our comparator function in Ruby to ensure effective and trustworthy sorting and comparison of items.&lt;br /&gt;
&lt;br /&gt;
To stick to the above Ruby standard, we have replaced the self-defined comparator functions and replaced them with the inbuilt rocket.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 rocket sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Methods Moved to Response Class===&lt;br /&gt;
It is crucial to create classes in object-oriented programming that are modular, maintainable, and scalable. Understanding the overall structure of the code and effectively modifying it cannot be easy when methods are dispersed across numerous subclasses. Additionally, having functions in the main class rather than a subclass makes more sense when they are closely related to the duties of the main class. Moving these methods to the main class may result in better code organization and a more straightforward program flow. Other subclasses can access the methods in the main class without redefining them, reducing code duplication and improving code reuse. Since this can result in more maintainable, scalable, and modular code, it is generally advised to move methods to the main class when closely related to its responsibilities.&lt;br /&gt;
&lt;br /&gt;
The following table contains the names of methods moved from subclasses to the &amp;quot;response.rb&amp;quot; class located at &amp;quot;app/models/response.rb&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Migrated Methods&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! File Location !! Method Name !! Commit Details&lt;br /&gt;
|-&lt;br /&gt;
| response_map.rb || app/models/response_map.rb || self.assessments_for(team), self.reviewer_assessments_for(team, reviewer), &amp;lt;=&amp;gt;(other_response) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/7eb2b4e53cc71423fe3d46341ee5dac9a56a2273 Commit]&lt;br /&gt;
|-&lt;br /&gt;
| review_response_map.rb || app/models/review_response_map.rb || self.get_responses_for_team_round(team, round, type) || [https://github.com/sbiyer/reimplementation-back-end/pull/1/commits/b58442673c65d2fa9fe2847c299ded36217b9ef7 commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Remove Unused Code===&lt;br /&gt;
Unused code must be removed to maintain code quality, lower code complexity, and enhance program performance in software development. Unused code can expand the size and complexity of the codebase, making it more challenging to maintain, debug, and update. Additionally, it may cause developers to become confused and raise the risk of introducing bugs or security vulnerabilities. The size and complexity of the codebase can be decreased by removing unused code, which will make it simpler to comprehend and maintain. As the compiler or interpreter does not need to allocate memory or processing power to execute inactive code, it can also enhance program performance. As the codebase becomes cleaner and more organized and the likelihood of running into issues in the future decreases, removing unused code can also aid in reducing technical debt.&lt;br /&gt;
&lt;br /&gt;
As part of this project, we identified unused code and removed it from the code base. One such example is below&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 unused sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
====Fix Broken Tests====&lt;br /&gt;
Significant changes were introduced into code, such as moving methods from sub-classes to the main class, as seen in the above implementations. It's common for test cases to break or no longer work as expected. It's essential to fix the test cases to ensure the code behaves as intended and to catch any potential bugs or issues introduced during the changes. By resolving the test cases, we confirmed that the code is still working as expected and that the changes have not inadvertently caused any problems. Additionally, fixing the test cases helps to identify and fix any issues that may have been present in the codebase before the changes were made. Some of the examples of test fixes made are given below.&lt;br /&gt;
&lt;br /&gt;
[[File:E2314 tests sample 1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
====New Test Cases====&lt;br /&gt;
In software development, testing, and unit tests are crucial because they ensure that the software works as intended and is free of bugs or errors. Before the software is made available to the general public, testing enables developers to find and address any issues, avoiding potential problems and saving time and resources. Because they test individual software units or components, unit tests are a crucial component of testing because they enable developers to pinpoint problems in a specific section of code and make targeted corrections. With this approach, developers can identify issues early on, saving time and resources while ensuring that the final product is high quality and meets users' needs. In conclusion, testing and unit testing is essential for guaranteeing the quality and dependability of software and ought to be a fundamental component of any software development process. For all the said reasons, we introduced test cases to test the response class as well as the sub classes review_response_map, teammate_review_response_map, response_map, and feedback_response_map.&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test review_response_map&lt;br /&gt;
[[File:E2314 tests sample 3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test teammate_review_response_map&lt;br /&gt;
[[File:E2314 tests sample 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test response_map&lt;br /&gt;
[[File:E2314 tests sample 4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Example of test cases added to test feedback_response_map&lt;br /&gt;
[[File:E2314 tests sample 5.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==How to Test==&lt;br /&gt;
&lt;br /&gt;
==Screencast==&lt;br /&gt;
&lt;br /&gt;
==GitHub==&lt;br /&gt;
The code corresponding to this project is available as open source. The code is found at https://github.com/sbiyer/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
Srini Iyer - [https://www.linkedin.com/in/sriniiyer LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Aswin Itha - [https://www.linkedin.com/in/aswin-itha LinkedIn] &amp;lt;br&amp;gt;&lt;br /&gt;
Suparno Saha - [https://www.linkedin.com/in/suparno-saha-81a05a91 LinkedIn]&lt;/div&gt;</summary>
		<author><name>Aitha</name></author>
	</entry>
</feed>