CSC/ECE 517 Fall 2013/oss ans: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 26: | Line 26: | ||
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 : | 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. | * 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. | ||
* | * An even better way to handle the rubrics would be to do subclassing of the rubric model in order to create two sub classes the rating rubric and the multipart rubric. As per the rubric being rendered the appropriate class would be called. | ||
== Appendix == | == Appendix == |
Revision as of 03:21, 30 October 2013
E807 : Refactoring and testing response_controller.rb
Introduction
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc)
Project Description
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.
- An even better way to handle the rubrics would be to do subclassing of the rubric model in order to create two sub classes the rating rubric and the multipart rubric. As per the rubric being rendered the appropriate class would be called.
Appendix
Setup Process
- We cloned the repo from https://github.com/expertiza/expertiza into our local directory.
- After installing MySQL server we loaded the test-db.sql sample database into the application
- In order to get the application working properly we added several routes in the routes.rb file.
Issues Encountered
External Links
- 1. Expertiza
- 2. VCL Link