CSC/ECE 517 Fall 2022 - E2277. Further Refactoring questionnaires controller.rb: Difference between revisions
Line 3: | Line 3: | ||
===Expertiza Background === | ===Expertiza Background === | ||
Expertiza is a web application where students can submit and peer-review learning objects (articles, codes, websites, etc). Instructors add and grade the assignments submitted by students to Expertiza. Students can be assigned in teams based on their selection of the topics. It has functionalities such as peer reviews in which students can provide feedback on others' work which helps peer in better developing the project. | Expertiza is a web application where students can submit and peer-review learning objects (articles, codes, websites, etc). Instructors add and grade the assignments submitted by students to Expertiza. Students can be assigned in teams based on their selection of the topics. It has functionalities such as peer reviews in which students can provide feedback on others' work which helps peer in better developing the project. The National Science Foundation supports it. | ||
=== Problem Statement === | === Problem Statement === | ||
<b>What is needed:</b> This project builds on E2257. That project focused on simplifying the methods in questionnaires_controller, while this project's objective is to | <b>What is needed:</b> This project builds on E2257. That project focused on simplifying the methods in questionnaires_controller, while this project's objective is to clean the code, but looking at a wider set of files - controllers, models and views. | ||
* | * Use temporary variables instead of instance variables wherever possible to narrow their scope. | ||
* question.rb contains a large number of constants. Make | * question.rb contains a large number of constants. Make explicit comments on their usage, and remove them if not used. | ||
* Since a controller should only create objects of one type the questions_controller could be introduced to create and edit questions moving the logic of dealing with individual questions into a separate controller, and improving the separation of responsibility. | * Since a controller should only create objects of one type the questions_controller could be introduced to create and edit questions moving the logic of dealing with individual questions into a separate controller, and improving the separation of responsibility. | ||
Revision as of 23:16, 20 November 2022
Introduction
This page gives a description of the changes made for the questionnaires_controller.rb of the Expertiza-based OSS project.
Expertiza Background
Expertiza is a web application where students can submit and peer-review learning objects (articles, codes, websites, etc). Instructors add and grade the assignments submitted by students to Expertiza. Students can be assigned in teams based on their selection of the topics. It has functionalities such as peer reviews in which students can provide feedback on others' work which helps peer in better developing the project. The National Science Foundation supports it.
Problem Statement
What is needed: This project builds on E2257. That project focused on simplifying the methods in questionnaires_controller, while this project's objective is to clean the code, but looking at a wider set of files - controllers, models and views.
- Use temporary variables instead of instance variables wherever possible to narrow their scope.
- question.rb contains a large number of constants. Make explicit comments on their usage, and remove them if not used.
- Since a controller should only create objects of one type the questions_controller could be introduced to create and edit questions moving the logic of dealing with individual questions into a separate controller, and improving the separation of responsibility.
Implementation
Flowchart
The following process is carried out to complete the project-
Testing
RSPEC Test Cases
Tests will be added once they've been implemented
Manual Testing
To be carried out.
SOLID Principle
SOLID is a set of rules that guide us on how to achieve that in object-oriented programming. Using SOLID guidelines you can avoid bad design in your code and give a well-structured architecture to your design. Bad design leads to an inflexible and brittle codebase, a simple and small change can result in bugs with bad design.
We implemented the single responsibility principle to divide the questionnaires_controller into questionnaires and questions controller thus ensuring that each controller does only one job.