CSC/ECE 517 Fall 2013/oss ans: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
The response controller creates, edits, and displays responses, that is, rubrics to be filled out, or filled-out rubrics. Our project requirement entailed the following things to be done.
The response controller creates, edits, and displays responses, that is, rubrics to be filled out, or filled-out rubrics. Our project requirement entailed the following things to be done.


* Reduce the method complexity in the response controller
* Reduce the method complexity in the response controller.
* Remove duplicated code
* Remove duplicated code.
* There were “custom_create” and “custom_update” methods for “custom” (multipart) rubrics. We already had create and update methods that were handling the normal rubrics. Our job was to use polymorphism in order to eliminate the custom methods.
* There were “custom_create” and “custom_update” methods for “custom” (multipart) rubrics. We already had create and update methods that were handling the normal rubrics. Our job was to use polymorphism in order to eliminate the custom methods.



Revision as of 03:08, 30 October 2013

E807 : Refactoring and testing response_controller.rb


Introduction

The response controller creates, edits, and displays responses, that is, rubrics to be filled out, or filled-out rubrics. Our project requirement entailed the following things to be done.

  • Reduce the method complexity in the response controller.
  • Remove duplicated code.
  • There were “custom_create” and “custom_update” methods for “custom” (multipart) rubrics. We already had create and update methods that were handling the normal rubrics. Our job was to use polymorphism in order to eliminate the custom methods.

Refactoring carried out

As per the project requirements the following work was carried out :

  • The duplicated code has been refactored and put in a separate method which is called wherever required. This prevents redundancy.
  • The variables set up in controller become automatically available to the views. Hence the repeated code from controller and view for finding the topic id signed up by a user/team has been deleted from controller and incorporated only in the response view.
  • The custom create and custom update methods have been removed. Their functionality has been merged with create and update methods as was mentioned in the requirement specification. Depending on the type of rubric rendered, the create and update method does the necessary updations.


Testing Done

Capybara tests were created for the response controller in order to carry out integration testing.

Future Work

Given the current state of the response controller there is still a lot of work that can be done in order to further improve the code. Based on our findings the following things can be done :

  • The controller still has some code that is only there for some specific assignments. This is bad design and this code needs to be removed.

Appendix